Steps to Install a Laravel App on a Shared server


This blog post is a helper document for novice Laravel developers trying to set up a Laravel app on a shared server. We will be posting a helper document for deploying a Laravel app on Cloud instances shortly.
Laravel is an enterprise-level, open-source, scalable and robust PHP MVC framework. Laravel is perhaps the most popular PHP MVC framework in the web development market. Laravel offers rich functionalities deriving from other frameworks such as CodeIgnitor, Yii, Symfony, RoR and NodeJs.   
 
In this post, we have used a shared server, turbo plan from ChemiCloud, using the Cpanel server and site management platform. ChemiCloud is an American cloud hosting company established in the year 2016. We have been using their service ever since Siteground withdrew its services from India, and truth be told, ChemiCloud offers much better service than Siteground.  ChemiCloud offers data centres in America, Europe, Australia and Asia. We have set up our server in the Mumbai data centre. 

 

How to Install a Laravel App on a Shared server?


Step 1:


Create a database on the shared server using either MySQL Databases or MySql Database Wizard. ChemiCloud also supports PostgreSQL. Make sure you note down the Database name, Username and Password. This step is critical as the app won't connect to the Database without these details. While selecting User privileges, make sure you allow all the necessary privileges required by the app.

 


How to Install a Laravel App on a Shared server?


 

Step 2:


Create an App folder (preferably within Public_html) and set up an FTP account for the folder using the FTP accounts service found within Files. Alternatively, One can use the Cpanel upload service to dump the app files. However, ideally, all the file transfers should happen through FTP to avoid any form of malicious activity.

 


How to Install a Laravel App on a Shared server?


 

Step 3:


Configure an FTP client to connect to the App folder created. ChemiCloud supports FTP and SFTP protocols and allows configuration file downloads. Once configured, move the app files to the folder created on the server.

 


How to Install a Laravel App on a Shared server?


 

Step 4:


In the app folder, locate the .env file and Update the Database name, username and password.

 


How to Install a Laravel App on a Shared server?


 

Step 5:


To admin a domain or a sub-domain, click on the Domains service. Add domain name or subdomain and update the Document Root to {path}/{app_name}/public.

 


How to Install a Laravel App on a Shared server?


How to Install a Laravel App on a Shared server?


 

Step 6:


To configure, click on the terminal service (founder under 'Advanced' grouping). Now, run the following Commands: 

cd {path}/{app_name}   
php artisan cache:clear    
php artisan view:clear    
php artisan route:clear    
composer dump-autoload    
 

The configuration is now complete.

 


How to Install a Laravel App on a Shared server?


How to Install a Laravel App on a Shared server?

Step 7:


Continue on the terminal window and run migrations. Now, run the following commands to Run migration:

php artisan migrate   
php artisan migrate: status    
 

Hopefully the migration is succesful.

Step 8 (Optional):


If you have set up DB seeing, then run the following command to seed

php artisan DB:seed 

The app is now ready for use; use the domain or subdomain to access the application. If you encounter issues, check the PHP version of the shared server by clicking on the 'Select PHP version' service under 'Software' Grouping.