pyy
pyy

Reputation: 953

Laravel 5.2 app - Debug is false but I'm still seeing PDO Exceptions

I have a laravel 5.2 application which is displaying the typical 'Whoops, something went wrong' PDO error when it can't connect to the database (which includes the IP of the DB and the username/password).

In my app.php file I've got:

'debug' => false,

I've also tried clearing my cache on the server to see if it was still stuck on debugging, but that didn't do anything.

Any help with how to stop this would be greatly appreciated.

Upvotes: 4

Views: 5630

Answers (6)

Abdulhakim Zeinu
Abdulhakim Zeinu

Reputation: 3829

You've to set APP_DEBUG=true inside .env file and inside config/app.php set 'debug' => env('APP_DEBUG', true)

Upvotes: 0

hmrk
hmrk

Reputation: 1

Just restart your server, ctrl+c on terminal and retype php artisan serve again. It works for me.

Upvotes: 0

Ryan
Ryan

Reputation: 24035

Unlike in the other answers, messing with php artisan config:cache and php artisan cache:clear and config/app.php did NOT help me.

I'd forgotten that I'd customized my setup in Laravel 5.7.

  1. To reduce confusion, temporarily delete any custom /resources/views/errors/500.blade.php you have.
  2. Check to see if you've customized /app/Exceptions/Handler.php. I'd forgotten that I'd overridden the prepareResponse function.

Upvotes: 2

Faustin Gashakamba
Faustin Gashakamba

Reputation: 171

I had the same problem, but clearing the cache (php artisan cache:clear) worked for me.

Upvotes: 1

pyy
pyy

Reputation: 953

I think I've finally got an answer...

Turns out I cached it using

php artisan config:cache

so I cleared it and now it works. I feel like a bit of an idiot after that..

Upvotes: 10

Iftikhar uddin
Iftikhar uddin

Reputation: 3182

Try this

Go to config directory, edit app.php and on line 16 comment out 'debug' => env('APP_DEBUG', false),

For commenting just add two slashes as below

//'debug' => env('APP_DEBUG', false),

Once you done that, it will now show simple generic error page if an error occurs.

Upvotes: 2

Related Questions