Laravel 5 - env local debug true no errors shown

前端 未结 12 1602
天命终不由人
天命终不由人 2020-12-08 19:52

I\'m trying to enable the debug for my app but it looks like I don\'t have any feedback.

The environment is set to local (in the .env file) and if I run



        
相关标签:
12条回答
  • 2020-12-08 20:15

    I actually solved the problem by un-commenting the line
    Dotenv::load(__DIR__.'/../'); in bootstrap/app.php.

    So that it actually loads it before compiling it and caching it ,
    well running php artisan optimize does it for you , if you have Laravel (Not Lumen)

    But if you look at their documentation it is commented out by default, i think they might have fixed it by now http://lumen.laravel.com/docs/installation.

    0 讨论(0)
  • 2020-12-08 20:15

    If the above answers didn't work for you, you may want to check the config files that you might have changed and start debugging from there.

    In my case, the above solutions didn't work for me because the root cause of my problem was changing the timezone in config/app.php file (from laravel default UTC I changed it to EST5EDT). For some reason the timezone setting change prevents laravel from logging the errors in storage folder and I am getting blank screen (no whoops! error message). I changed the timezone to America/New_York instead and the error logs are working again.

    Hope this helps.

    0 讨论(0)
  • 2020-12-08 20:17

    As Blair said, it may turn out that you put some wrong code in the middleware or in 'Exceptions/Handler.php' e.g. :

    if($e->getStatusCode()===404) { ... }

    instead of

    if($e instanceof NotFoundHttpException) { ... }

    0 讨论(0)
  • 2020-12-08 20:18

    php artisan optimize and if it still does not work delete the file storage/meta/compiled.php as mentioned in a forum topic on Laracasts

    I had the same problem and the artisan command did the trick.

    UPDATE

    I found out that a nice way to workaround storage folder related issues is to set www-data as its owner. I'm using two commands:

    sudo chown $(whoami):www-data . -R
    

    and

    sudo chown www-data: storage -R
    

    From Laravel 5.1 it may be necessary to do this last command on bootstrap folder too.

    0 讨论(0)
  • 2020-12-08 20:18

    Also if you just installed lumen make sure you have renamed .env.example to .env in your main app directory as it won't work if your config is still named environment file is still named .env.example.

    0 讨论(0)
  • 2020-12-08 20:18

    Just for the sake of completeness, I had this issue when the error occurred in methods that used Model::findOrFail($someId). Replacing it with Model::find($someId) displayed the error log.

    0 讨论(0)
提交回复
热议问题