Deploying Laravel 5 applications on shared hosting without the use of SSH

Abednego Edet on March 03, 2018

First, it is well discouraged to use a shared hosting for your Laravel 5 app. There are other very cheap web hosting starting from USD $7 per mon... [Read Full]
markdown guide

It's ok on my local. but when i upload it on my hosting, I have this error.

You don't have permission to access /index.php on this server.
Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

Can you please tell me how to fix it. thank you.


I had this error. Firstly, there could be a file on the host that is already rerouting you via the .htaccess. After sorting this, then my host required a php.ini in the root directory and this needed to be a "production one" as opposed to a local one. Then bootstrap/cache/config.php had hard-coded references to my local PC, but not compatible with the hosting platform. With that the 500 Internal Service error was gone.


Change the file access permissions for public folder, the permission error will disappear, everything should work normally now, unless you missed a step :)


also you can use this -->

package to run migrations and upload files without ssh


It seems to be working fine but one problem is that while I am trying to delete some resource lets say Post. I have used:

if($editor->image != null) {

I am unable to go to that path where the image is located. How to reach that path so that I can unlink it.


I have error Class 'PDO' not found, is that exception related to this tutorial?


Nah, I think this is as a result of bad PDO installation or php.ini config file, try to install or reinstall PDO extension then restart server.
The error actually means PDO class does not exist,


I have developed a laravel project first time. It works fine in local.

I have VPS-1000 hosting from inmotion

Which method i should follow. is it a shared hosting?

So far i tried your mentioned technique

create a folder in root folder laravel and upload all my projects files into it
then move public folder to public_html/subdomain folder

change the autoload and bootstrap path in index file (followed this 4. change the following lines (22 and 36))

update my env and config/database file with my database credential

it given an error : SQLSTATE[HY000] [2002] Connection refused (SQL: select * from information_schema.tables where table_schema =

used localhost instead and also tried to change port 3306 to 33060 but failed

also i have tried.. upload full projects into public_html/subdomain folder and use htaccess to locate public index file. But same error.

Can you please tell me how to fix it. thank you.


I never recommend shared hosting for Laravel applications. There are so many problems with it. Instead you can use DigitalOcean, Linode or Vultr. Amazon web services is a good choice. You can also checkout Cloudways for one click deployment of Laravel Applications:


After using your method to deploy my laravel app, all the pages loaded clean and easy. Big thanks for that bro. Although i have an issue with files i store in the storage/app/public directory. Uploading images to that directory is always successful but it seems impossible for me to view images from that directory to the blade view

Storage::disk('local')->url('file.jpg') seems to work on my local server but does not work on the remote server.

I did not use asset('storage/file.jpg') because I am not permitted to create a symlink on the host with ssh or php artisan


Let us take a look at the default Laravel 5 application structure:

app //directory
contains restricted server-side application data

app/storage //directory
contains a writeable directory used by Laravel 5 and custom functions to store data ( i.e. log files, etc... )

public //diectory
this directory is accessible to anyone on the web.

If I were you, I would upload the file to the public directory directly.

Try this:

  1. Store image here: public_path() . 'img/filename.jpg'
  2. Save the 'img/filename.jpg' in database
  3. Generate the image URL with url('img/filename.jpg') Output //

SQLSTATE[28000] [1045] Access denied for user 'root'@'localhost' (using password: NO) (SQL: select * from sessions where id = eRLLuTsdfGhYugsApdfgsdfgujtikyuh2ygfiAZ9ePXig limit 1)


I am deploying on a sub domain using laravel 5.7, but I am unable to locate the index.php file in root directory of subdomain.


Ok, the index.php is located in public directory, but the listed changes is not making the app running.


Thank you for the tutorial. But as I did the same that you have mentioned, all my css, js, images are not getting displayed on the browser. What should I do, as I have checked my path also. Please help.



How about having more than 1 laravel app in the same shared hosting?

I'm trying to upload a second app using a subdomain for example: points to public_html/test

But does not works for me... but if I upload a HTML file with dummy text and I type it's ok!

How can I have more than 1 laravel app (different files, different public folder, different everything) in the same shared hosting (CPANEL)

Thanks u and sorry for my poor english.


how to generate key ,

as per instructions this command is needed Run this command for key generation
php artisan key:generate
Migration and seeding
php artisan migrate --seed
Installing dependencies
composer install
Folder Permissions
sudo chmod -R 777 storage bootstrap/cache


Hi, Thanks for saving my day...!
I have an ultimate (goDaddy) plan where i host multiple web apps. That is add on domains are added and those directories are inside public_html. What will I do in this case? Where i need to put project folder and contents in public directory?


Thank you! I needed it to start a project. I explain to clients that a shared hosting has its limitations, it is good to start but I also make recommendations to improve over time.


Thanks a lot. I was having a problem deploying a laravel project of mine. But now it's fixed.


You are welcome, am glad to hear that,
Cheers :)


when i'm public folder content move public_html but more than 2 project how to handle this


If we're making changes to the path of Laravel's public directory. Wouldn't it be wise to let Laravel know about it by binding the paths as discussed in the given below article?



Order allow,deny
Deny from all

to the .htaccess file to prevent your .env file from being publicly accessible


I've Laravel 5.6 application and I was following your steps, but there is nothing showing when I open my application site in browser. It's blank. Can you please help me?


Nice article, it worked for me in my laravel app 5.2 but the rest pages apart from the homepage is not working.

code of conduct - report abuse