2

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.

  • I've checked the error log file maintained by Apache, it's empty.
    • Was wondering if it's a permissions issue, doesn't seem to be the case (all folders set to 775 and files set to 664 as specified by various sources and owned by serverName:userName)
  • Browser console simply shows a 500 server error.
  • All I see if "Whoops, looks like something went wrong." twice.
    • There must be some way to show better error details (config debug setting already set to true)

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!
Marc Bosse
  • 336
  • 1
  • 3
  • 17
  • Have you generated a new application key? You may need to run `php artisan key:generate` Also, ensure you have a working .env file. – andromeda Jun 22 '18 at 16:09
  • .env is in place (even though I'm not using a database for this application), good suggestion. I'll try the key generation – Marc Bosse Jun 22 '18 at 16:11
  • It seems to have successfully generated the new key, though nothing seems to have changed unfortunately. – Marc Bosse Jun 22 '18 at 16:14
  • have you checked the error log maintained by laravel ? – apokryfos Jun 22 '18 at 16:21
  • 1
    The env is not just for db connections; laravel uses it for other things too such as the fact that it contains your application key. It's good if you already have it. This is likely a permissions issue so check this out and follow it to the latter again https://stackoverflow.com/questions/30639174/file-permissions-for-laravel-5-and-others?answertab=votes#tab-top then see if you get a different error message – andromeda Jun 22 '18 at 16:22
  • 1
    Look in storage/logs for the log file and see what the error is. When you get a Whoops error, Laravel will log the error message. – Devon Bessemer Jun 22 '18 at 16:25
  • @Devon, just found it! Thanks for the suggestion will post contents momentarily – Marc Bosse Jun 22 '18 at 16:29
  • @user123456 Thanks for the link, looking in to it now! – Marc Bosse Jun 22 '18 at 16:30
  • @user123456 I've following that tutorial line-by-line and the moment I connect my 'public/index.php' to the autoload all I can see is 'Whoops something went wrong'. The only new entry in my error log is when 'bootstrap/autoload.php' wasn't linked properly. – Marc Bosse Jun 22 '18 at 17:17
  • Noticing this in my Laravel.log: production.ERROR: RuntimeException: The only supported ciphers are AES-128-CBC and AES-256-CBC with the correct key lengths. – Marc Bosse Jun 22 '18 at 17:21
  • 1
    Run `php artisan config:clear` – andromeda Jun 22 '18 at 17:26
  • 1
    You're almost there. Just generate another key and clear your cache. – andromeda Jun 22 '18 at 17:27
  • @user123456 YOU SAINT! Thank you for taking the time to walk me through this. Did you want to provide an answer to get all the credit? – Marc Bosse Jun 22 '18 at 17:29

2 Answers2

4

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

andromeda
  • 4,433
  • 5
  • 32
  • 42
0

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

Shahroze Nawaz
  • 589
  • 5
  • 9