Laravel on shared hosting

I will show you not the fastest but easiest way to move Laravel project to shared hosting. You need to be sure that you are using PHP version >= 5.6.4.

First step

First connect to your FTP and create folder outside “public_html”. You can use any name but in this example I will use (“Laravel”) for the name of this folder.

Move everything except “public” folder from your Laravel project to your newly created folder on shared hosting. It will take some time!

In “public_html” folder you need to move files from “public” folder in your Laravel project.

Open index.php file and change the paths to autoload.php and app.php files. They should point to files in the Laravel folder.

Second step

Import your Laravel project database to shared hosting

Then in your Laravel folder open .env file and change database credentials.

Example:

DB_DATABASE=laravel-app
DB_USERNAME=root
DB_PASSWORD=laravel-p@ss

Third step (optional)

If you need to use storage files then create php file named symlinkcreate.php and upload it to public_html.
This is example how to create symlink to your storage folder.


*USER* – Your user account on shared hosting

Please execute the php script and after that you can delete it.

Leave a Reply

Your email address will not be published. Required fields are marked *