Laravel 5 – env local debug true keine Fehler angezeigt
Lesezeit: 3 Minuten
Ich versuche, die Fehlerbehebung für meine App zu aktivieren, aber es sieht so aus, als hätte ich kein Feedback.
Die Umgebung ist auf lokal eingestellt (in der .env-Datei) und wenn ich sie ausführe
php artisan env
Ich verstehe das
Current application environment: local
Die Debug-Konfiguration für meine lokale Umgebung ist auf eingestellt true
Rückkehr [
'debug' => true,
Also if I set in my main config file (app.php inside the config folder) the debug = true I still have ho feedback that there is an error in the code.
I only have an empty page if there is an error in the code (as for debug = false)
What am I missing?
I have worked around the issue by chmod -R 777 storage/ on my host machine (Mac OS X). On my guest machine (Ubuntu 14.04) chmod -R 777 storage/ did not change permissions actually.
For the record, setting 777 permissions is really dangerous even if you are in a development environment. Avoid unless you know what you’re doing.
– George D.
May 9, 2015 at 8:46
do not do this a production server, just set /storage to be available to Apache
– Mirko
Mar 15, 2017 at 21:26
phaberest
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.
Thanks for the hint, I found that the problem was in the permissions to the storage folder. It’s weird because the log file (inside the storage folder) was correctly created, and correctly updated – no permission errors for this file? – so I just chmod -R 777 on storage folder and now I can see the errors. I didn’t run the php artisan optimize because I just updated composer (that in the end does the same thing as the command above) and I was looking at the folder you mentioned and I actually don’t have that folder (that’s why I thought about permissions issue). Thanks
– peppeocchi
Nov 28, 2014 at 16:37
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).
– phaberest
Jan 14, 2016 at 15:44
Blair
I had a situation where I had the exact same symptom, some routes were not providing any feedback, just a white page, no error in the log no information at all.
Turns out, I was adding a new middleware, and I forgot to return $next($request) from my handle method. This was even more frustrating, because this middleware did not apply to every route, so I assumed that there was an intermittent error that was being thrown but not displayed on these routes.
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) { ... }
Even on Windows needs to do : chmod -R 777 storage/
You can run it with Git Bash;
Countach
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.
Fahad
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)