APP_DEBUG=true is being ignored
Solution 1
if you have 404 error page in views/errors
it will be displayed, and if you haven't, NotFoundHttpException
will be displayed.
Solution 2
I'm very late to the game here, but if nothing else worked try clearing all cache and then run:
php artisan optimize:clear
Solution 3
Just add this two lines in your error view, for example in views\errors\404.blade.php
<?php $e = new Symfony\Component\Debug\ExceptionHandler(); ?>
<?php echo getenv('APP_DEBUG') == 'true' ? $e->getContent(Symfony\Component\Debug\Exception\FlattenException::create($exception)) : ''; ?>
This will show the laravel debug error in your custom 404 error page.
I'll-Be-Back
Updated on June 21, 2022Comments
-
I'll-Be-Back almost 2 years
I have
APP_DEBUG=true
in the.env
file:APP_ENV=local APP_DEBUG=true APP_LOG_LEVEL=debug APP_URL=http://test.dev
I've deliberately use incorrect incorrect url (eg:
test.dev/asdsadsa
) which does not in the web.php route file.I expected to get an laravel debug error when route does not exist
Sorry, the page you are looking for could not be found. NotFoundHttpException in RouteCollection.php line 161:
However, it keep showing 404 error page (views/errors/404.blade.php) even
APP_DEBUG
is set to true.What I have tried:
1 - I even tested to make sure laravel can read .env file:
Route::get('/', function() { dd(env('APP_DEBUG')); });
return
true
2 -
php artisan config:cache
did not fix it.3 -
chmod -R 777 storage
did not fix it. -
I'll-Be-Back over 7 yearsI've just done that now, I have removed
'Symfony\Component\HttpKernel\Exception\HttpException'
from$dontReport
and it didn't fix it. -
num8er over 7 yearsThen I don't have any suggestion. It's 5.3 maybe something's changed. Let me know if You'll able to fix that (share Your knowledge). (;
-
I'll-Be-Back over 7 yearsCheck ABDEL-RHMAN answer.
-
num8er over 7 years@I'll-Be-Back yeah, I was thinking about that but due my experience with 5.2, I though that it cannot be so stupid simple (: