0

I've set in my php.ini file the values:

display_errors  On
display_startup_errors  On

And in my laravel application:

 'debug' => env('APP_DEBUG', true),

But when i purpose write some gibberish in my controller method the page gets blank instead of displaying an error. What else is suppressing this to show an error message?

marko
  • 10,684
  • 17
  • 71
  • 92
  • Did you try to add also `error_reporting(E_ALL);` – S.I. Nov 10 '16 at 06:40
  • Write this - ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); - in either your controller file where you get the blank or else you can write in main file like index.php. make sure if you use namespace in your class then write this below the namespace – Manthan Dave Nov 10 '16 at 06:40
  • I set the error_reporting(E_ALL); I think in phpinfo() it's showing: error_reporting 32767. Actually I wouldn't like to put those lines in the application. I've had it working on windows without a hassle. – marko Nov 10 '16 at 06:43
  • 1
    Be sure that you edit correct __php.ini__.. – S.I. Nov 10 '16 at 06:49
  • There is so many, maybe the wrong one. But phpinfo gets updated. – marko Nov 10 '16 at 07:12
  • https://xdebug.org/docs/all_settings Was xdebug.force_display_errors=Off. It overrides the other settings obviously. – marko Nov 11 '16 at 16:19
  • You might find this [this answer](https://stackoverflow.com/a/36269588/2675981) useful – Apolymoxic Jul 13 '17 at 16:44

3 Answers3

2

Got to the location /etc/php/7.0/apache2 and also enable the error on in php.ini residing here.Don't forget to restart apache2

Pankaj Cheema
  • 1,028
  • 2
  • 13
  • 26
1

Was xdebug.force_display_errors=Off in php.ini. It overrides the other settings obviously.

marko
  • 10,684
  • 17
  • 71
  • 92
0

Add ini_set('display_errors', 1); on top of the code. Once you finish debugging, you can remove it. Also you can set these up based on environment variables. For example you can set constant DEVELOPMENT to true only in development environment and use following code to enable error reporting

if (defined('DEVELOPMENT') && DEVELOPMENT === true)
{
    ini_set('display_errors', 1);
    error_reporting(E_ALL);
    ini_set("display_errors", 1);
}
Ima
  • 1,111
  • 12
  • 22