2

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

7
  • Error 500 can pretty much mean anything. At what point does that error pop up? What did you last change? What does the server error log tell you? Commented Nov 12, 2013 at 12:05
  • If you are getting a 500 error - you need to look in your apache logs or higher up. Remove sections of code until you are at a basic Laravel install (or start with a basic install to make sure it works). Commented Nov 12, 2013 at 12:06
  • error pop up in my example at echoing $notExistingVar (which doesn't exist), and I cant see nothing. In real project I used Eloquent methods with wrong syntax. If I get it correctly apache logs - those which I indicate in virtual host? (like /etc/apache2/sites-available/mysite). If true, then there is no info. But I'm pretty sure PHP should output something like "var doesn't exists", no? Commented Nov 12, 2013 at 12:33
  • No. PHP defines variables automatically, so in your case that var is just empty, so the output will be blank. Commented Nov 12, 2013 at 12:35
  • Well, in any case I still get 500 error when I try to echo this variable, or, for example, when I try to use unexisting function Commented Nov 12, 2013 at 12:42

2 Answers 2

2

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)

Sign up to request clarification or add additional context in comments.

Comments

1

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'.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.