Victor
Victor

Reputation: 5353

Display errors in laravel 4

I know there is a similar question: How to display errors on laravel 4?

But I can't figure out at all how to enable error displaying. what I've done:

  1. In php.ini I set "display_errors = On", "error_reporting = E_ALL", "error_log = /var/log/php_errors.log"
  2. In laravel's config (app.php) - debug mode
  3. I looked at /app/storage/logs (no logs)
  4. I looked at php_errors.log (only a simple warning here)
  5. In virtual host config I specified error.log path but no info here

My code is simple:

public function getTest() {
    // phpinfo();
    echo $notExistingVar;
    die('123');
}

I cant see '123', instead I got 500 error (looked in Chrome development tools)

  1. I tried multiple times "service apache2 restart" when I changed something
  2. And I also tried to specify settings by ini_set directly in the code

Seems like I miss something simple, but I only see the WSOD. All the time. Any help is greatly appreciated

update

At least

    ini_set('display_errors', '1');

helped. Not in php.ini but in php script file itself

Upvotes: 2

Views: 5926

Answers (2)

Erik Verheij
Erik Verheij

Reputation: 193

Laravel disables display_errors in vendor\laravel\framework\src\Illuminate\Foundation\start.php with

if ($env != 'testing') ini_set('display_errors', 'Off');

This leaves you with one of the following options

  1. As you suggested overwrite it later on with

    ini_set('display_errors', 'On');
    
  2. Disable ini_set with the disable_functions directive

  3. Set the Laravel environment to 'testing'.

Upvotes: 1

Victor
Victor

Reputation: 5353

Finally!

I specified App::error callback and included 403, 404, and 500 error pages. I put simple text like "403" in 403.php, "404" in 404.php, but forgot to put anything in 500.php. Instead of white page I always saw something like "Server error" in Chrome, so totally forgot about this callback.

When you specify App::error then you won't get debug messages (doesn't matter debug is set to true or false in app config)

Upvotes: 2

Related Questions