0

Can't figure this one out. I'm hosting my Laravel site on Digital Ocean. To deploy the site I user deployer from deployer.org and their Laravel Recipe. Havn´t really changed anything in their config but whan I deploy I can visit the startpage just fine but any other page renders a 500 error. What gives?

UPDATE:

Hi all! the .env file seems fine, it has a KEY and all seemt to be OK there. However, I'm getting this from the nginx error log:

PHP message: PHP Fatal error:  Uncaught ErrorException: file_put_contents(/var/www/html/mymoodloop.com/shared/storage/framework/views/d4454779c3105d08ab77675858536547a95ae530.php): failed to open stream: Permission denied in /var/www/html/mymoodloop.com/releases/9/vendor/laravel/f$
Stack trace:
#0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'file_put_conten...', '/var/www/html/m...', 122, Array)
#1 /var/www/html/mymoodloop.com/releases/9/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php(122): file_put_contents('/var/www/html/m...', '<?php $__env->s...', 0)
#2 /var/www/html/mymoodloop.com/releases/9/vendor/laravel/framework/src/Illuminate/View/Compilers/BladeCompiler.php(122): Illuminate\Filesystem\Filesystem->put('/var/www/html/m...', '<?php $__env->s...')
#3 /var/www/html/mymoodloop.com/releases/9/vendor/laravel/framework/src/Illu

And here's the permissions for the storage folder:

drwxr-sr-x+ 5 deployer www-data 4096 Jan  7 13:26 storage
Joel
  • 3,166
  • 5
  • 24
  • 29
  • 2
    Have you checked the php/laravel log files? – Derek Pollard Feb 18 '19 at 21:56
  • storage/logs tell us what you find, only from here we can shoot in the dark. – mrhn Feb 18 '19 at 22:54
  • I am not familiar with Deployer.org but checking out the Laravel recipe here https://github.com/deployphp/deployer/blob/master/recipe/laravel.php I am not seeing it create a .env file. I would make sure there is a .env file there and that it has a `APP_KEY` – Eric Van Joshnon Feb 19 '19 at 01:30
  • Hi guys, not sure how the stack overflow notifications work but I just updated the question with some info from the error logs. Any help is much appreciated, thanks for your answers so far! – Joel Feb 19 '19 at 07:55

2 Answers2

0

It's highly likely that you have forgotten to set the APP_KEY as an environment variable, or placed in the .env file. Either place your app into debug mode (APP_DEBUG=true in your .env file) or check the logs in the storage/logs directory to see the output of what's gone wrong.

Dwight
  • 12,120
  • 6
  • 51
  • 64
  • Please see the update I did for the answer, the app key seems fine, the .env file updates when I run the `php artisan key:generate` command... – Joel Feb 19 '19 at 07:56
0

After some troubleshooting the site now seems fine. Really unclear what it was that did the trick though but I changed /bootstrap/cache and /storage to 0755 and removed all of the old deployer releases in /releases. This seems to have made the site happy again.

Joel
  • 3,166
  • 5
  • 24
  • 29
  • Are you using `require 'recipe/laravel.php';` in your deploy script? It does a bunch of laravel related things including making sure the storage folder is set up correctly. – Colyn Brown Apr 12 '19 at 14:16