Reputation: 10828
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.
Upvotes: 7
Views: 27439
Reputation: 1213
Make sure you have .env file in the root folder of the laravel project. If you don't have one, please search how to create laravel .env file and create it.
Upvotes: 0
Reputation: 2364
I'm very late to the game here, but if nothing else worked try clearing all cache and then run:
php artisan optimize:clear
Upvotes: 2
Reputation: 11
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.
Upvotes: 1
Reputation: 3014
if you have 404 error page in views/errors
it will be displayed, and if you haven't, NotFoundHttpException
will be displayed.
Upvotes: 5
Reputation: 19372
Remove make sure that Your App\Exceptions\Handler
does not have in $dontReport
this line:
'Symfony\Component\HttpKernel\Exception\HttpException'
take a look at documentation: https://laravel.com/docs/5.3/errors#the-exception-handler
and find:
Ignoring Exceptions By Type
The $dontReport property of the exception handler contains an array of exception types that will not be logged. For example, exceptions resulting from 404 errors, as well as several other types of errors, are not written to your log files. You may add other exception types to this array as needed
Upvotes: 0