Marc Bosse
Marc Bosse

Reputation: 401

Deploying Laravel 5.4 to Shared Hosting

I've got a real head-scratcher for you! I've been working on a Laravel 5.4 application for quite some time now and up until yesterday I had been able to:

  1. develop on my local machine [still works flawlessly],
  2. push my changes to my BitBucket repo [still okay here],
  3. and would subsequently pull those changes to my shared hosting server (RedHat) [still running smoothly],
  4. I then run my dependency managers (npm and composer) to get the project in place and functional
  5. there is some matter with clearing various caches:
    • php artisan view:clear
    • php artisan route:clear
    • php artisan cache:clear
    • composer dump-autoload
  6. and finally move my '/public' folder to the web root and update index.php to point back to the 'bootstrap/autoload.php' in main project structure,
  7. I am aware there is likely another or several steps I am missing, but I am unsure what they are...

All that being said, I've attempted to deploy a number of applications using Laravel lately and I always seem to run into the same issue come time to deploy an application to production. I've read 30+ tutorials on the matter and nothing seems to explain the issue why my site isn't working any more.

Any suggestions at this point would be beneficial to send me looking in the right direction!

======= UPDATES =======

For the sake of thoroughness, and that this save others from severe headaches, I'll be posting actions taken here.

  1. Following tutorial mentioned by @user123456 (permissions applies)
  2. Generate new key for application
  3. Run php artisan config:clear
  4. Off to the races, answer to come!

Upvotes: 2

Views: 768

Answers (2)

Shahroze Nawaz
Shahroze Nawaz

Reputation: 589

I would never recommend using shared hosting for Laravel application. You will face lots of issues for permissions, composer and external dependencies. Instead, you can use cloud servers like DigitalOcean, Linode, vultr and deploy laravel application on them. If you don't know about linux and creating Stacks you can use Cloudways to deploy laravel.

https://dev.to/rizwan_saquib/deploy-laravel-application-on-cloud-easily-with-cloudways

Upvotes: 0

Cepheus
Cepheus

Reputation: 4903

You need to ensure you have a working .env file.

Once done, run php artisan key:generate to create a key for your application after which you should clear your application's cache as follows php artisan config:clear

Upvotes: 4

Related Questions