Deploying Laravel on shared Hosting

ndiecodes profile image Ndifreke Friday Updated on ・2 min read

If you are here, you are probably exploring how laravel works on shared hosting, on some low-budget project or just have reasons you prefer shared hosting. Alright, let's get down to business.

Here are the steps to get laravel up and running on shared hosting:

(1) Run php artisan config:clear; this clears the cache config. Since you are going to be editing .env online; you don't need your local configurations cached.

(2) Export Your migrated Database to a file (db.sql) without the create database statement, like so:


CREATE TABLE `users` (
 `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
 `title` varchar(255) DEFAULT NULL,
 `name` varchar(255) NOT NULL,
 `facebook_id` varchar(255) DEFAULT NULL,
 `google_id` varchar(255) DEFAULT NULL,
 `linkedin_id` varchar(255) DEFAULT NULL,
 `tagline` varchar(255) DEFAULT NULL,
 `email` varchar(255) DEFAULT NULL,
 `username` varchar(255) DEFAULT NULL,
 `email_verification_code` varchar(255) DEFAULT NULL,
 `email_verified_at` timestamp NULL DEFAULT NULL,

 `password` varchar(255) DEFAULT NULL,
 `remember_token` varchar(100) DEFAULT NULL,
 `created_at` timestamp NULL DEFAULT NULL,
 `updated_at` timestamp NULL DEFAULT NULL,

DROP TABLE IF EXISTS `password_resets`;

CREATE TABLE `password_resets` (
 `email` varchar(254) NOT NULL,
 `token` varchar(254) NOT NULL,
 `created_at` timestamp NULL DEFAULT NULL,
 KEY `password_resets_email_index` (`email`)

(3) go to MultiPHP Manager on c-panel and confirm you have php 7.1 or higher.

(4) Zip the finished project (we will call this myproject from now on) and upload to root directory of hosting storage through File Manager (c-panel) or FileZilla; it should be something like /home/domain-name.

(5) Extract myproject in root directory(/home/domain-name) of hosting storage.

(6) Enable "Show Hidden Files". This is so you could see files like .htaccess, .env, etc.

(7) In myproject/public, move all it's contents to /public_html.

(8) Now edit /public_html/index.php to point to your laravel project, like so:

//previous state
require __DIR__.'/../vendor/autoload.php';

// changed to
require __DIR__.'/../myproject/vendor/autoload.php';

//previous state
$app = require_once __DIR__.'/../bootstrap/app.php';

//changed to
$app = require_once __DIR__.'/../myproject/bootstrap/app.php';

(9) Edit .env in /myproject with your config keys

(10) Import and run the db.sql script you exported earlier on your created database through phpmyadmin on c-panel.

The end!

Posted on by:

ndiecodes profile

Ndifreke Friday


A Javascript Lover || Laravel Advocate || Continuous Learner || Software Developer


markdown guide

Thanks for your blog post, I have a couple of questions though 😉

How about the symbolic link to the storage directory? Most shared hosting providers don't allow the creation of symbolic links.

And this seems to work perfectly for new installs, what would you suggest the flow would be for updates that require DB migration?


You are right, not all shared hosting providers allow creation of symbolic links so I have mostly just uploaded my public files to public_html by changing root path in filesystem config.

For update on db migrations... You will probably need a sql script to alter your tables or alter it manually using phpmyadmin.


A friend of mine recommended this package (github.com/kofoworola/route-commands); It let's you run artisan commands through web routes. Pretty neat 😇


Hi, In my experience shared hosting is not recommended for Laravel. You can instead use cloud servers like Digitalocean, Vultr, Linode etc. Also if you are non-technical you can use managed solution like Cloudways.



Hoping to help the impatient like me, here is a php script that can help us save a lot of time for deployment on shared hosting: laravel-deployer.planethoster.world


Great article explaining this process.. Thanks for the great work.


Do i need to upload vendor and node_modules to the ftp server??


Yes on vendor, not sure about node_modules - It depends I guess.


Thanks for reading up man 🙇‍♂️