IqbalBary
IqbalBary

Reputation: 1126

Uploading Laravel 5 Project to Shared Hosting

I want to deploy a Laravel 5 project to shared hosting from my localhost but I am facing so many problems. I have uploaded all files in a subfolder of my shared hosting (PHP 5.5) and when I try http://domain.com/subfolder/public its showing me 500 error. I check the laravel.log but found nothing, set the storage/ to 777 but still no changed (showing last error from localhost).

I also check .htaccess and it seems good. I search a lot and try so many thing but still facing same problem.

Now, my shared hosting give access of SSH so I have installed a new Laravel project. Then copy my edited and added file except vendor from my localhost to Hosting. Then I update the composer and dump-autoload, Now my application is working file.

But I am not sure about the process I did. Is it the right way (I don't think so)? Please let me know what was the problem of directly uploaded file and is there any problem if I use second system for my production app.

Upvotes: 1

Views: 597

Answers (2)

NateNjugush
NateNjugush

Reputation: 51

I know it's a little late but you need to either: 1. Make laravel's public folder the root folder of your domain or 2. Make a sub-domain and point the root folder to your projects public folder. The disadvantage with this is that your sessions cannot be connected directly to your main domain's sessions.

Upvotes: 0

Bagus Tesa
Bagus Tesa

Reputation: 1695

There are chances that your route cache is messed up. It is safe to artisan route:clear, artisan cache:clear, and artisan view:clear before uploading your files to ensure that no compiled script left - which usually tied to specific path.

But it is unclear, could you share your stacktrace for your error (and if possible share where your .htaccess file and it's content)? sorry i can't comment, need higher point. However, by looking at your statement that it works by moving your files (controller, views, public, etc) but not the entire project, i believe clearing caches is the best to try.

As for the deployment of laravel project, there are methods suggested in laravel.io. It is not a good idea to expose your entire laravel files in public folder. Nevertheless, there are many ways to deploy it.

Upvotes: 1

Related Questions