InMotion Hosting Support Center https://www.inmotionhosting.com/support/ Web Hosting Support & Tutorials Tue, 14 Nov 2023 17:24:08 +0000 en-US hourly 1 https://wordpress.org/?v=6.4.1 https://www.inmotionhosting.com/support/wp-content/uploads/2019/09/imh_favicon_hd.png InMotion Hosting Support Center https://www.inmotionhosting.com/support/ 32 32 Understanding the Laravel env File https://www.inmotionhosting.com/support/edu/laravel/understanding-the-laravel-env-file/ https://www.inmotionhosting.com/support/edu/laravel/understanding-the-laravel-env-file/#respond Wed, 08 Nov 2023 02:34:13 +0000 https://www.inmotionhosting.com/support/?p=107818 Read More >]]> Understanding the Laravel env file

Here’s a complete guide to help you understand the Laravel .env configuration file.

Introduction

There is a certain thrill in typing artisan serve and seeing your Laravel application come to life. But what powers the environment-specific configurations behind the scenes is the unsung hero: the .env file. This file is crucial in shaping the behavior of a Laravel application, ensuring that it operates correctly in different environments.

If you have not had the chance to install Laravel yet, visit our comprehensive guide on How to Install Laravel to get started.

What is the .env File?

.env, short for “environment,” is a hidden file that Laravel applications use to define variables that need to be different depending on where the application is running. It’s a key player in Laravel’s approach to the Twelve-Factor App methodology, which emphasizes strict separation of config from code. The .env file allows developers to tailor the application’s behavior without altering code, making it adaptable and secure.

Structure of the .env

Within the .env file, each setting is a variable defined by a key-value pair, separated by an equals sign. These settings can include everything from your app’s name and environment to more sensitive configurations like database credentials and payment gateway API keys. The structure is straightforward, making it easy for developers to read and update.

APP_NAME=Laravel
APP_ENV=local
APP_KEY=base64:Qz7...
APP_DEBUG=true
APP_URL=http://localhost

LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=

BROADCAST_DRIVER=log
CACHE_DRIVER=file
FILESYSTEM_DISK=local
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120

MEMCACHED_HOST=127.0.0.1

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_MAILER=smtp
MAIL_HOST=mailpit
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS="hello@example.com"
MAIL_FROM_NAME="${APP_NAME}"

AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false

PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_HOST=
PUSHER_PORT=443
PUSHER_SCHEME=https
PUSHER_APP_CLUSTER=mt1

VITE_APP_NAME="${APP_NAME}"
VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
VITE_PUSHER_HOST="${PUSHER_HOST}"
VITE_PUSHER_PORT="${PUSHER_PORT}"
VITE_PUSHER_SCHEME="${PUSHER_SCHEME}"
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

Setting Up the .env

Creating and managing your .env file is a breeze. When you spin up a new Laravel project, it comes with a .env.example file. This file is a template containing common environment variables with dummy values. To get started, you should duplicate this file, rename it to just .env, and populate it with your specific settings. This approach ensures that your application’s sensitive details are never hard-coded into your application’s version-controlled source code.

Security and the .env File

The .env file’s simplicity belies its importance in keeping your application secure. Since it often contains sensitive information, it’s paramount that this file is never shared or stored in a public repository. Laravel’s default .gitignore file is set up to exclude .env from version control, reflecting best practices in security.

Common .env Variables

The .env file typically houses variables that are essential for the application’s runtime configuration. These include:

  • APP_ENV: Defines the environment the application is running in.
    • local: This is typically used during development on a developer’s local machine. When set to local, Laravel may display more debugging information and enable certain features that are useful during development.
    • production: When the application is live and being used by end-users, APP_ENV should be set to production. In this mode, error messages are suppressed or minimized to avoid exposing sensitive information.
    • staging: This is often used for a pre-production environment that mirrors the production environment as closely as possible. It’s used for final testing before deploying to production.
    • testing: This environment is used when running automated tests, such as PHPUnit tests or Dusk browser tests. Laravel is configured to use different settings that are optimized for testing environments.
    • custom environments: Besides the standard environments, developers can define their own, such as development, qa (quality assurance), or any other custom environment name that suits their workflow. Laravel does not limit the naming or the number of environments you can have.
  • APP_KEY: A base64 encoded string that Laravel uses for encryption and session storage.
  • DB_CONNECTION: Specifies the type of database connection, such as mysql, postgres, sqlite.
  • DB_HOST, DB_PORT, DB_DATABASE, DB_USERNAME, DB_PASSWORD: These settings configure the database connection details.
  • MAIL_MAILER, MAIL_HOST, MAIL_PORT, MAIL_USERNAME, MAIL_PASSWORD: These are used to set up the mail driver and server details for sending emails.

Accessing .env Variables in Laravel

Laravel provides a helper function env() to fetch environment variables from the .env file. This function is used throughout Laravel’s configuration files, which are stored in the config directory, to apply these settings. For example, the database configuration file at config/database.php uses env('DB_DATABASE') to get the database name.

Troubleshooting Common .env File Issues

A common issue developers face is that changes to the .env file don’t seem to reflect immediately. This usually happens because Laravel caches the configuration to improve performance. To clear the cache and make sure the new .env values are being loaded, you can run:

php artisan config:cache

Ensure that all necessary variables are set in the .env file to avoid runtime errors.

Conclusion

The .env file is a powerful feature of Laravel that allows for flexible configuration management, allowing developers to maintain a clean separation between code and configuration. By understanding how to effectively use and secure the .env file, you can ensure that your Laravel applications are flexible, secure, and ready for any environment.

]]>
https://www.inmotionhosting.com/support/edu/laravel/understanding-the-laravel-env-file/feed/ 0
Migrating Your WordPress Website to Platform i Manually with rsync https://www.inmotionhosting.com/support/product-guides/wordpress-hosting/central/migrate-manually-rsync/ https://www.inmotionhosting.com/support/product-guides/wordpress-hosting/central/migrate-manually-rsync/#respond Tue, 07 Nov 2023 16:59:32 +0000 https://www.inmotionhosting.com/support/?p=107780 Read More >]]> Hero image with text Migrating WordPress with rsync via Command Line platform i inmotion hosting

For large or busy websites, a manual transfer is the most reliable way to ensure that your migration is successful. In this guide, we’ll focus on using the command line, using the rsync protocol. Remote synchronization using rsync has a few major advantages including the ability to easily resume interrupted transfers, and quickly re-sync any files that have changed. This guide will also feature using WP-CLI over ssh, a convenient way to manipulate WordPress websites from a remote terminal.

Throughout this guide, we’ll use the terms Origin site and Destination site to refer to your old hosting provider to your new site on Platform InMotion.

Prepare the Origin Website for Migration

There are several things you should do to get ready for your transfer ahead of time, including some housekeeping and maintenance tasks that often fall through the cracks on any live website. Check out our Ultimate Guide to WordPress Migration for a detailed list of things to prepare for during a website transfer.

As always when performing a major operation on your website, you should make sure that you have a backup of your website. 

Set up SSH Keys for Access from Server to Server

First, follow these instructions to add an SSH key to your Platform i VPS and log into your server. Now, we’ll set up a separate key that you’ll use to communicate between the origin server and the destination server.

  1. Log into your Platform i VPS via SSH, and switch to the wordpress user.
    su - wordpress
  2. Create the .ssh directory and generate a new SSH key. 
  3. Follow the interactive prompts to name the key and add a passphrase to ensure the security of your new key.
    mkdir -p ~/.ssh && cd ~/.ssh/ && ssh-keygen
  4. In this example, the new key is named transfer_key for clarity’s sake. If you name your key something different, replace the name of the key in the following commands in this guide.
  5. Run the following command to print your public key:
    cat transfer_key.pub
  6. Copy the public key, and add it to your Origin Server‘s authorized keys. This step will depend on your hosting provider, so check their documentation if you’re not sure. Here’s a guide on adding the key using cPanel.
  7. Once it’s added, test the connection with a command similar to the following, substituting your origin user and server for username@example.com:
    ssh -i ~/.ssh/transfer_key username@example.com

Configure SSH to use Origin Server Easily

Next, we’ll set up a simple configuration file to make our lives easier for the rest of the process. Enter the command nano ~/.ssh/config and enter the following values for your origin server:

 Host origin
      	User username
        HostName example.com
        IdentityFile ~/.ssh/transfer_key

Substitute your User and origin server HostName for the values above. Type ctrl-x, y, and enter. You may need to set the correct permissions for the config, using the command:
chmod 600 config

Now, you’ll be able to simply use the command ssh origin instead of typing out the path to the key, username, and server hostname.

[wordpress@vps##### .ssh]$ ssh origin
Enter passphrase for key '/home/wordpress/.ssh/transfer_key': 
Last login: Fri Nov  3 11:10:49 2023 from vps#####.inmotionhosting.com
user@example.com [~]#

Using WP-CLI Over SSH to Connect to Your Origin Server

Let’s gather some information about your origin website that we’ll need later in the migration process. Use the following command to get your Database Table Prefix:

[wordpress@vps##### ~]$ wp --ssh=origin --path=public_html --version
Enter passphrase for key '/home/wordpress/.ssh/transfer_key': 
WP-CLI 2.8.1
[wordpress@vps##### ~]$ wp --ssh=origin --path=public_html config get table_prefix
Enter passphrase for key '/home/wordpress/.ssh/transfer_key': 
wp_

In this example, the table_prefix value is the default wp_ but yours may differ. If that’s the case, be sure to make a note of it.

Put the Origin Site into Maintenance Mode

This step is optional, but you may want to place your origin site into maintenance mode to prevent any changes during the database export. Use the following command, or use one of the popular maintenance mode plugins available on the WordPress Repository.

[wordpress@vps##### ~]$ wp --ssh=origin --path=public_html maintenance-mode activate
Enter passphrase for key '/home/wordpress/.ssh/transfer_key': 
Enabling Maintenance mode...
Success: Activated Maintenance mode.

Exporting and Copying the Database with scp

Next, we’ll export the database and transfer it to our destination server using the scp command. In this example, we’re naming the database export file transfer_db.sql to make sure it’s easy to remember.

[wordpress@vps##### ~]$ wp --ssh=origin --path=public_html db export transfer_db.sql
Enter passphrase for key '/home/wordpress/.ssh/transfer_key': 
Success: Exported to 'transfer_db.sql'.
[wordpress@vps##### ~]$ scp origin:transfer_db.sql ./
Enter passphrase for key '/home/wordpress/.ssh/transfer_key': 
stdin: is not a tty
transfer_db.sql                               100%  327KB  25.3MB/s   00:00 
[wordpress@vps##### ~]$ ls
cloud-apps  doc_root  logs  transfer_db.sql

Back up Your Existing Site on the Destination Server

It’s a good idea to back up your existing site on the destination server, even if it’s merely a fresh WordPress installation, because it has your existing database credentials, database options, and .htaccess rules.

[wordpress@vps##### ~]$ cp -r doc_root doc_root.bak
[wordpress@vps##### ~]$ ls
cloud-apps  doc_root  doc_root.bak  logs  transfer_db.sql
[wordpress@vps##### ~]$ wp --path=doc_root db export ./doc_root.bak/backup_db.sql
Success: Exported to './doc_root.bak/backup_db.sql'.
[wordpress@vps##### ~]$ 

Transfer Your Origin Site Files to the Destination Server with rsync

Next, let’s proceed with transferring your site files to the destination server. In this example, we’re excluding the wp-config.php file to maintain the database connection to the site. If you have important directives in your origin site’s wp-config.php, it’s recommended to set them up after performing the transfer.

[wordpress@vps##### ~]$ rsync -azv --exclude wp-config.php origin:public_html/ ./doc_root

Since we use d the -v option, you’ll see the files begin to transfer over listed as they progress. If this process is interrupted, you can simply repeat the same command and the sync will resume without overwriting the files that have already been transferred.

Import the Database to the Destination Server

[wordpress@vps##### ~]$ wp --path=doc_root db import ./transfer_db.sql 
Success: Imported from './transfer_db.sql'.

Now, since we set the origin site into maintenance mode before exporting its database, we’ll need to deactivate maintenance mode after the import.

[wordpress@vps##### ~]$ wp --path=doc_root maintenance-mode deactivate

If your origin site had a different table_prefix than the default wp_, you’ll also need to set that. Replace ‘wp_’ in the following command with your table prefix.

[wordpress@vps##### ~]$ wp --path=doc_root config set 'table_prefix' 'wp_'

The next command may be optional, but to be safe we’ll run a script provided by your UltraStack VPS to ensure that all the file permissions are correct.

[wordpress@vps##### doc_root]$ fixperms wordpress

Use the Platform i Dashboard to Set the SiteURL

This step will differ depending on whether you plan to immediately update your site’s DNS to point to your destination server. If you are, follow the steps in this guide to add your domain and use the Site URL tool to set your site up on the correct domain.

If you want to test the site before transferring your DNS, which is recommended, follow these steps.

  1. Log into Platform i and navigate to the project you’re working on.
  2. Navigate to the Site URL tool, and select the Original Hostname from the drop-down list
  3. Click Continue, then Apply
    screenshot of the site url tool with the original hostname selected

This process will take care of replacing your internal links so that you can thoroughly test the site.

Repair the Connection to Platform i

Once you’ve set the Site URL, you’ll likely still see a connection error in your Platform i Dashboard. Click Fix it For Me to install, activate, and configure the Central Connect plugin.

Common Troubleshooting for Transferred Sites

If you’re experiencing any problems with your newly transferred site, here are a few common things to check.

Issues with Transferred .htaccess Rules

Issues with .htaccess may present symptoms like 404 errors, 403 errors, or 500 errors. Check your transferred .htaccess file for directives that may have been set by cPanel or your origin host. Commonly, you can simply replace your .htaccess file with the one you backed up earlier.

[wordpress@vps##### ~]$ cp doc_root.bak/.htaccess doc_root/.htaccess

PHP settings

You may have transferred over a php.ini or user.ini file from your origin server that may cause issues. You can troubleshoot these by simply moving the file to another name to check if the symptoms are resolved.

[wordpress@vps##### ~]$ mv doc_root/php.ini doc_root/php.ini.bak

Conclusion

Using rsync is a powerful way to transfer WordPress sites because it is very fast, stable, and easily resumable if the connection is interrupted. Be sure to check out our Ultimate Guide to WordPress Migration for many other ways to transfer your website. Congratulations, you’ve now transferred your site to Platform InMotion!

]]>
https://www.inmotionhosting.com/support/product-guides/wordpress-hosting/central/migrate-manually-rsync/feed/ 0
Introduction to MVC (Model-View-Controller) https://www.inmotionhosting.com/support/edu/laravel/model-view-controller-intro/ https://www.inmotionhosting.com/support/edu/laravel/model-view-controller-intro/#respond Fri, 03 Nov 2023 21:42:11 +0000 https://www.inmotionhosting.com/support/?p=107643 Read More >]]> Introduction to Model-View-Controller Header

Model-View-Controller, commonly known as MVC, is a design pattern that has become a cornerstone in modern web and software development. MVC offers a structured approach to organizing code, MVC ensures that applications are scalable, maintainable, and efficient. This article aims to provide a comprehensive introduction to MVC, its components, benefits, and its implementation in popular frameworks.

History of MVC

In the late 1970s, MVC was initially conceived to manage the complexity of graphical user interfaces. Trygve Reenskaug introduced it during his time at Xerox PARC. Over time, as web development evolved, so did MVC. It transitioned from desktop applications to a mainstay in web application design, offering a systematic approach to building software.

Understanding the Components

There are three components of MVC:

Model-View-Controller Diagram

Model

The Model is the application’s dynamic data structure, independent of the user interface. It directly manages the data and the business rules. For instance, if you were building a banking application, the Model would handle tasks like calculating interest or transferring funds between accounts.

View

The View is responsible for displaying data from the Model to the user in a presentable format. In our banking application example, the View would be the interface where users see their account balances, transaction histories, and other relevant details.

Controller

The Controller accepts user commands and handles them appropriately. It’s the brain of the application, making decisions, and ensuring the Model and View work in harmony. In the banking scenario, when a user deposits money, the Controller determines how this action should be processed.

Benefits of Using MVC

Separation of Concerns

One of the most significant advantages of MVC is the clear separation it offers. Each component has a distinct responsibility, ensuring that the business logic, user interface, and user input remain separate.

Scalability

As applications grow, adding new features or making changes becomes more manageable with MVC. You can modify one aspect of an application without having to touch others.

Reusability

Components in MVC are modular, promoting reusability. This modularity means developers can use the same Model with different Views or vice versa.

Testability

With separate components, unit testing becomes more straightforward. Developers can test individual parts without relying on the others.

MVC in Different Programming Languages

Ruby on Rails (Ruby)

Rails, with its “convention over configuration” philosophy, provides developers with a set of conventions to follow, reducing the number of decisions they need to make.

Laravel (PHP)

Laravel has become a favorite among PHP developers. Its Eloquent ORM, routing capabilities, and blade templating engine make it a powerful tool for web development.

Joomla (PHP CMS)

Beyond being a CMS, Joomla offers an extensive API for developers, allowing for MVC-based web application development.

AngularJS (JavaScript)

AngularJS revolutionized front-end development. Its two-way data binding, directives, and services make it a robust tool for building dynamic web applications.

Common Misconceptions about MVC

While MVC is widely adopted, it’s not without its misconceptions. Some developers believe MVC introduces unnecessary complexity, especially for smaller projects. Others feel it’s just a buzzword without tangible benefits. However, when understood and implemented correctly, MVC can be a game-changer, even for small projects.

Getting Started with MVC

For newcomers, the world of MVC might seem daunting. However, many resources can help. Starting with frameworks that have extensive documentation, like Laravel or Ruby on Rails, can offer a smoother learning curve. Engaging with community forums, attending workshops, and practicing by building simple applications can solidify understanding.

Dive deeper into MVC with these resources:

Conclusion

The MVC pattern has really stood the test of time, showing it has what it takes to stick around in the tech world. It offers a structured approach to application development, ensuring that projects remain scalable and maintainable. As with any tool or methodology, the key lies in understanding its nuances and applying it effectively.

Now that you are familiar with the Model-View-Controller design pattern, choose from our PHP Hosting, VPS Hosting, or Dedicated Servers to host your applications and websites today!

]]>
https://www.inmotionhosting.com/support/edu/laravel/model-view-controller-intro/feed/ 0
Starting From Scratch with your UltraStack VPS https://www.inmotionhosting.com/support/product-guides/wordpress-hosting/central/starting-from-scratch/ https://www.inmotionhosting.com/support/product-guides/wordpress-hosting/central/starting-from-scratch/#respond Fri, 03 Nov 2023 17:23:17 +0000 https://www.inmotionhosting.com/support/?p=107773 Read More >]]> Hero image with text Starting from Scratch Platform i InMotion Hosting

When you’re getting started with your new UltraStack VPS on Platform InMotion, you have three options to begin with:

If you’re not planning to move a site from another hosting provider to your new VPS, the best option is to start from Scratch.

What is “Starting from Scratch?”

When you start from scratch, you’ll begin with WordPress pre-installed with the latest stable version of WordPress from WordPress.org. This will include the latest default theme and default plugins typically included with a fresh installation, including Hello Dolly and Akismet.

How to Start from Scratch on Platform InMotion

  1. Once your new VPS has finished provisioning, you’ll see the Get Started button in your project.
  2. Click on Get Started, and choose Start from Scratch.
    Screenshot showing the Start from Scratch option highlighted
  3. You’ll see the Overview screen including some details about your new website and a WP Admin button to log into your new website.
  4. Start creating your new website!

What’s Next?

You can install your favorite theme and plugins, and start designing your new website. Check out our Getting Started Guide for WordPress for some ideas on what to do nest.

]]>
https://www.inmotionhosting.com/support/product-guides/wordpress-hosting/central/starting-from-scratch/feed/ 0
How to Check the Laravel Version of Your Project https://www.inmotionhosting.com/support/edu/laravel/check-laravel-version/ https://www.inmotionhosting.com/support/edu/laravel/check-laravel-version/#respond Tue, 31 Oct 2023 15:11:25 +0000 https://www.inmotionhosting.com/support/?p=107537 Read More >]]> How to Check the Laravel Version of Your Project

Laravel, a popular PHP framework, is known for its simplicity and elegance when it comes to web development. With each new release, Laravel introduces enhancements, bug fixes, and exciting features. It’s crucial for developers to know which version of Laravel they are working with, as this information can affect the compatibility of packages, libraries, and the overall stability of their applications. In this article, we will explore various methods to determine the Laravel version installed on your system.

You may want to revisit The Laravel Directory Structure for an overview of the key directories and their roles within a Laravel project

Using the Laravel Artisan Command

One of the most straightforward ways to check the Laravel version is by using the Laravel Artisan command-line tool. Here’s how you can do it:

Using your terminal or command prompt, navigate to your Laravel project’s root directory and run the following command:

php artisan --version

This command will display the Laravel version of your project.

Laravel Framework 10.3.0

Checking the Laravel Framework Application File

Laravel stores information about its version in a file Application.php within the framework’s core directory. You can use the cat command to view the contents of this file.

Navigate to your Laravel project’s root directory. Use the cat command to display the Laravel version:

cat vendor/laravel/framework/src/Illuminate/Foundation/Application.php | grep "const VERSION"

This command will output the Laravel version to the console.

const VERSION = '10.3.0';

Checking the Composer.json File

Another way to determine the Laravel version is by inspecting the composer.json file in your Laravel project’s root directory. Composer uses the composer.json file to specify project dependencies.

Navigate to your Laravel project’s root directory. Open the composer.json file, look for the “require” section, and find the entry for Laravel which specifies the version installed.

    "require": {
        "php": "^8.1",
        "laravel/framework": "^10.0",
    }

In this case, Laravel version 10.0 is installed.

Conclusion

Knowing which version of Laravel is installed in your project is crucial for maintaining compatibility with packages, libraries, and keeping your application up-to-date with the latest features and security patches. By using the Laravel Artisan command, inspecting the Application.php file, or checking the composer.json file, you can easily determine the Laravel version you are working with. This information will help you make informed decisions when developing and maintaining your Laravel applications.

]]>
https://www.inmotionhosting.com/support/edu/laravel/check-laravel-version/feed/ 0
How to Upgrade or Downgrade your Platform i VPS https://www.inmotionhosting.com/support/product-guides/wordpress-hosting/central/servers/upgrade-downgrade/ https://www.inmotionhosting.com/support/product-guides/wordpress-hosting/central/servers/upgrade-downgrade/#respond Tue, 17 Oct 2023 15:00:33 +0000 https://www.inmotionhosting.com/support/?p=107203 Read More >]]> hero image with the text Updgrade or Downgrade Your VPS Platform i InMotion Hosting

You can easily upgrade or downgrade your Platform i Server depending on your budget and performance requirements. Upgrade for more Disk Space, RAM, or CPU cores easily directly from your Project menu.

How to Resize your Server

  1. Log into Platform i.
  2. Click on the Project you’d like to upgrade or downgrade.
  3. Note that you can see the current performance Tier at the top of the VPS environment. Click Resize.
    Screenshot showing the Resize button on the project overview screen
  4. Select the Performance Tier you need for your server.
  5. Note: if you are changing to a lower tier, you will only be able to proceed if your server is not using more disk space than the Tier you’ve chosen.
  6. Click Next and confirm your payment information.

How is my Billing Affected by Upgrading or Downgrading my Server?

For your initial purchase, you’ll be charged or credited a pro-rated amount based on your renewal schedule. At your next renewal, you’ll be charged the regular amount for your Performance Tier.

Congratulations! You now know how to upgrade or downgrade your Platform i VPS to meet your website’s growing needs!

]]>
https://www.inmotionhosting.com/support/product-guides/wordpress-hosting/central/servers/upgrade-downgrade/feed/ 0
The Laravel Directory Structure https://www.inmotionhosting.com/support/edu/laravel/laravel-directory-structure-guide/ https://www.inmotionhosting.com/support/edu/laravel/laravel-directory-structure-guide/#respond Thu, 12 Oct 2023 12:57:35 +0000 https://www.inmotionhosting.com/support/?p=106965 Read More >]]>

This guide will help you become familiar with the Laravel directory structure.

Introduction

Once you have installed Laravel, understanding the Laravel directory structure is crucial for efficient and effective application development. This guide provides a concise and clear overview of the key directories and their roles within a Laravel project, allowing you to navigate and utilize them with confidence.

Breakdown of the Laravel Directory Structure

Laravel’s directory structure is logically organized into various directories, each with a specific purpose. This section offers a detailed explanation of directories like app, config, database, and others, highlighting their significance in a Laravel application.

drwxrwxr-x 7 app
drwxrwxr-x 3 bootstrap
drwxrwxr-x 2 config
drwxrwxr-x 5 database
drwxrwxr-x 2 public
drwxrwxr-x 5 resources
drwxrwxr-x 2 routes
drwxrwxr-x 5 storage
drwxrwxr-x 4 tests
drwxrwxr-x 39 vendor

The App Directory

The app directory contains the core code of your Laravel application, housing the essential classes and application logic. It is divided into several subdirectories, each with a defined role in the application’s structure.

The Bootstrap Directory

The bootstrap directory is responsible for initializing the application by setting up configurations and establishing the execution environment for your Laravel projects.

The Config Directory

The config directory contains configuration files allowing you to modify the application’s behavior to meet specific requirements.

The Database Directory

The database directory holds migrations, factories, and seeds, facilitating streamlined database operations for your Laravel application.

The Public Directory

The public directory holds the index.php file as well as assets such as CSS, JavaScript, and images; serving as the entry point for the application.

The Resources Directory

The resources directory manages views, language files, and other assets, ensuring efficient resource management for applications hosted on different platforms.

The Routes Directory

The routes directory controls the URL patterns, routing them to the correct controllers and methods.

The Storage Directory

The storage directory manages files, including compiled Blade views and user-uploaded content.

The Tests Directory

The tests directory organizes testing files, contributing to the stability and reliability of your Laravel application.

The Vendor Directory

The vendor directory centralizes all external dependencies and libraries, simplifying integration and management.

Conclusion

Navigating the Laravel directory structure is vital for understanding the framework’s organization and functionality. Whether you’re just starting your Laravel journey or are a seasoned developer, a solid understanding of this structure is invaluable for creating robust, scalable, and efficient applications.

]]>
https://www.inmotionhosting.com/support/edu/laravel/laravel-directory-structure-guide/feed/ 0
How to Install Laravel https://www.inmotionhosting.com/support/edu/laravel/how-to-install-laravel/ https://www.inmotionhosting.com/support/edu/laravel/how-to-install-laravel/#respond Mon, 02 Oct 2023 16:00:52 +0000 https://www.inmotionhosting.com/support/?p=106766 Read More >]]>

Here’s a comprehensive guide on how to install the Laravel PHP framework on your server.

Introduction

As a favorite amongst PHP developers, Laravel boasts of an elegant syntax and streamlined development processes. Here, we’ll guide you through the installation process so that you can start developing directly on your server.

Prerequisites

Before you dive into Laravel, make sure your server meets the following requirements:

  • PHP version of 8.1 or higher.
    • PHP extensions required: BCMath, Ctype, cURL, DOM, Fileinfo, JSON, Mbstring, OpenSSL, PCRE, PDO, Tokenizer, and XML.
  • A web server such as Apache or Nginx.
  • A database management system such as MySQL, MariaDB, or PostgreSQL.
  • Composer installed. Laravel uses Composer as a package manager to manage its dependencies.

We’re going to help you check that you have all prerequisites installed. If you don’t, we’ll link you to documentation to help install them, ensuring a smooth Laravel installation process.

PHP Version

Check to see if you have the required PHP 8.1 (or above) installed as the system default for your server by running php -v which should output the version.

PHP 8.1.23 (cli) (built: Sep 13 2023 02:57:29) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.23, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.23, Copyright (c), by Zend Technologies

If you need to install a newer PHP version and/or PHP extensions, for servers with cPanel you can Upgrade PHP using EasyApache 4.

Web Server

To check to see if you are running a web server and the version, in your server’s terminal run httpd -v for Apache or nginx -v for Nginx.

$ httpd -v
Server version: Apache/2.4.57 (cPanel)
Server built:   Sep 12 2023 20:22:59

$ nginx -v
nginx version: nginx/1.23.4 (imh_ngx_20230406)

If you don’t see a web server installed, please visit our Apache Tutorials and Nginx Tutorials for installation steps.

Composer

To check to see if Composer is installed on your server by running composer -V in your server’s terminal which should produce output similar to this

Composer version 2.4.4 2022-10-27 14:39:29

If Composer is not installed on your server, you can install it locally for your project or globally by visiting the Composer Installation Documentation.

Use Laravel Installer to Create a Project

The Laravel Installer is a tool that provides a streamlined method for creating a fresh Laravel project. It’s a convenient alternative to the traditional method of installing Laravel through Composer. By using the Laravel Installer, users can swiftly initialize a new Laravel application by executing a simple command in their terminal or command prompt. This simplifies the process, making it more efficient and user-friendly, especially for those who frequently work with Laravel projects. The installer downloads the latest version of Laravel, sets up all the directories and permissions, and makes the application ready for development.

If you prefer to create a Laravel project with the default configuration that you can modify later, you can quickly Create a New Laravel Project with Composer.

As the user for the account that you want to install Laravel, use Composer to install the Laravel Installer.

composer global require laravel/installer --update-with-all-dependencies

You want to make sure that you add $HOME/.config/composer/vendor/bin to your PATH so the Laravel executable is found when you run the Laravel command to create a new project.

For Bash, you can automatically add this to your $HOME/.bashrc file by typing the following

echo 'export PATH="$PATH:$HOME/.config/composer/vendor/bin"' >> ~/.bashrc

You can either log out and back in or run source ~/.bashrc for the changes to take effect

Create a New Laravel Project

Now that you successfully set up the Laravel Installer, you can use the laravel command to create a new Laravel project. Navigate to the document root of the target domain and start the Laravel installer with your_project_name being a name of your choice for the project.

laravel new your_project_name

This will create the directory your_project_name and start the installer.

   _                               _
  | |                             | |
  | |     __ _ _ __ __ ___   _____| |
  | |    / _` | '__/ _` \ \ / / _ \ |
  | |___| (_| | | | (_| |\ V /  __/ |
  |______\__,_|_|  \__,_| \_/ \___|_|


 ┌ Would you like to install a starter kit? ────────────────────┐
 │ › ● No starter kit                                           │
 │   ○ Laravel Breeze                                           │
 │   ○ Laravel Jetstream                                        │
 └──────────────────────────────────────────────────────────────┘

Laravel’s documentation provides detailed information on Starter Kits.

Create a New Laravel Project with Composer

For a simpler and quicker alternative to using the Laravel Installer, you can use the composer command to create a new project. Navigate to the empty document root of the domain you want Laravel installed and initiate your project.

composer create-project laravel/laravel .

Once that completes, you should see the default Laravel files in the current working directory.

If you see an error stating that the directory is not empty

                                                                                                                              
Project directory "/home/producthub/laraveltest.product-content-hub.com/lartest/test-project/test-project/." is not empty.  
                                                                                                                              

Make sure there aren’t any hidden files that may be blocking the installation by running ls -lah to list all files (including hidden files) and directories within your current working directory.

Viewing your New Laravel Installation

To be able to see the default Laravel installation page by visiting your domain, add the following to your .htaccess file in your domain’s document root to make sure that your website is being served from Laravel’s /public directory.

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>

If you installed Laravel into a subdirectory using the Laravel Installer, you can either move the installed files and directories to the domain’s document root or you can add the following to your .htaccess file in your domain’s document root (replacing your_project_name with the actual directory that Laravel was installed):

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)$ your_project_name/public/$1 [L]
</IfModule>

You should now be able to view your Laravel installation by visiting your domain in your web browser.

Conclusion

Now that you have installed Laravel and confirmed that it was successful, you can begin building your project! The .env file contains different environment configuration values such as database information and application URL that can be edited to fit the needs of your new project.

]]>
https://www.inmotionhosting.com/support/edu/laravel/how-to-install-laravel/feed/ 0
Registering a New Domain Name https://www.inmotionhosting.com/support/domain-names/registering-a-new-domain-name/ https://www.inmotionhosting.com/support/domain-names/registering-a-new-domain-name/#comments Wed, 20 Sep 2023 18:09:38 +0000 https://www.inmotionhosting.com/support/2011/09/16/registering-a-new-domain-name/ Read More >]]> Domain Registrations are $19.99 per year and Domain Transfers are $11.99. When you transfer a domain, it will automatically add an additional year to your existing renewal date.

Domains can be easily registered right within your Account Management Panel (AMP). The domain TLD (top level domain) extensions we can register here at InMotion Hosting are listed here:

Available Domain Extensions.com.net.org.us.biz.info

Of note, if you want to register a domain name with a .us extension, you will need to have a physical US address.

Don’t have time to read our article? Watch our walk-through video.

How to Register a New Domain Name

  1. Login to AMP (Account Management Panel).
  2. Click the Register Domain button in the Manage My Account section.
    Register Domain located in AMP
    Or hover over Domains in the top navigation menu then click Register New Domain.
    Register Domains Menu Item
  3. You will then be taken to the Domains page.
    AMP Marketplace - Domains
  4. Once you type in the domain name that you would like to register, you will be presented with more options.
    AmpMarketplaceDomains-2
  5. When you have confirmed your selection, the journey will proceed to the Term & Privacy page.
  6. After you have made your selection and click Add To Cart, you will proceed to the Cart Checkout where you can review your order, select a payment method, and order your new domain.

    Once the order is complete, you can now begin to use your domain!

Domain Privacy

Did you know that whenever a domain name is registered, The Internet Corporation for Assigned Names and Numbers (ICANN) requires your personal information be published in the WHOIS database? This includes your mailing address, phone number, and email address!

With Domain Privacy Protection from InMotion Hosting, we will make our information available to the public instead of yours. This can help protect you from potential spammers, telemarketers, and even identity thieves. This would cost only an additional $15.99 annually! Otherwise, we would have to use the billing information we currently have on file for your account. This is usually the name and address of the person who subscribed for the hosting account initially.

Your name will remain as the registrant contact so that you retain complete ownership of the domain. To register a new domain you will first need to log into AMP. If you need more information about logging into AMP.

Domain Privacy Protection is available with all hosting accounts, including shared hosting, VPS hosting, and our dedicated servers.

What about other domain extensions?

Keep in mind you can still host any domain with InMotion by pointing to our nameservers, and adding the domain to your cPanel. There are many other domain extensions that are available as well. There are extensions specific to every country as well as other more restrictive extensions such as .edu. Very soon, ICANN will be releasing around 700 other extensions for sale as well. If you need a domain that has an extension different from the ones we offer, your best bet is to visit Google and do a search for a registrar of that type. For example, if I want a .ca domain, I would do a search for “register .ca domain“.

]]>
https://www.inmotionhosting.com/support/domain-names/registering-a-new-domain-name/feed/ 70
How to Add a Modpack to your Minecraft Server https://www.inmotionhosting.com/support/product-guides/minecraft/how-to-add-a-moddpack-to-your-minecraft-server/ https://www.inmotionhosting.com/support/product-guides/minecraft/how-to-add-a-moddpack-to-your-minecraft-server/#respond Tue, 22 Aug 2023 15:02:15 +0000 https://www.inmotionhosting.com/support/?p=106189 Read More >]]> While Setting up a Modpack on your Minecraft Server Hosting plan can sound like quite the task, it is actually quite simple. Whether you are looking to spice up your gameplay or try out something new, modpacks can give an entirely different experience depending on the modpack you go with. This guide will cover step-by-step how you can set up any modpack on your Minecraft Server.

Add a Modpack to Your Server

  • Login to your Game Management Panel and double-click the Minecraft Instance on which you would like to add a Modpack.
  • Click Stop and wait for the server to full stop before proceeding.
  • Retrieve the Modpack of your choice from their Official Download page and then use one of the following methods to upload it to your server: Upload it to your server using the Minecraft File Manager or by connecting to your server with SFTP.
    Or, use the Download Here tool in the Game Management Panel by navigating your way to the FIle Manager and right-clicking to get the menu below:

    Click the Download file here button and paste the Direct URL of the modpack of your choice in the text field and click OK.
  • Once the files are fully uploaded and present in your File Manager, if it is a compressed file such as a .Zip archive, right-click the file and click Extract.
  • Take note of the Minecraft Server JAR file name that the modpack of your choice is using (reference your modpack’s documentation to see which .jar file is the one you are meant to use). In this case, ours is called minecraft_server.jar.
  • Navigate using the menu on the left side of your screen to the Configuration Section.
  • Click on the Server Settings Option.
  • Look for the Server JAR option and click Scan for New JARs in order to ensure the system has a current list of JARs to display.
  • Using the dropdown menu, Select the JAR file name that Matches the name we took note of in Step 5.
  • Check your modpack’s documentation to confirm what version of Java it requires and confirm that the version is set by navigating the Configuration menu and clicking onto the Java and Memory Section.
  • On this new page you will see a section called Java Version. Select the Java Version using the dropdown menu.
  • You are Almost Done! Just head over to the Console and Start your Minecraft Server.


Congratulations! You are now set up with your very own Modded Minecraft Server running your modpack of choice. Don’t forget to bookmark our Minecraft Server Hosting Product Guide for more helpful tutorials on how to build and manage your game server.

]]>
https://www.inmotionhosting.com/support/product-guides/minecraft/how-to-add-a-moddpack-to-your-minecraft-server/feed/ 0