9

I don't know how php.ini was configured since I don't have access to it. But on top of my php code file I have

error_reporting(E_ALL); ini_set('display_errors', '1');

But still, if there is an error, e.g. missing a ")", the page is blank. It is so painful to debug without error message. Why were the errors not shown?

asked Mar 26, 2010 at 20:35
1
  • The only thing I can think of is that you're not calling those statements before the error occurs. If they're called after the error occurs, the error will kill the script and it will never get called. Commented Mar 26, 2010 at 20:42

2 Answers 2

3

Your error is not an execution error, as it's a Parse Error : it happens before the page even starts being executed.

So, the two intructions that you used have not been executed yet when this error is happening... and, so, they have no effect.


A solution that would help with those Parse Errors would be to just not have them ; a couple of things that could help :

  • Using an IDE that can detect wrong PHP code
    • Eclipse PDT, for instance
    • Or netbeans
  • Use php -l your-php-file.php to check if it's valid
answered Mar 26, 2010 at 20:49
2
  • +1 there is also a crazy workaround to get parse errors displayed as normal ones: de.php.net/manual/en/function.set-error-handler.php#91535 but the points you mention are usually the better way to go. Commented Mar 26, 2010 at 20:51
  • @Pekka : oh, didn't think about that ; but using auto_prepend_file is a nice/fun/clever idea -- wouldn't do that, but it's clever ^^ Commented Mar 26, 2010 at 21:55
0

The error's weren't shown in this particular case because the error happened before any code was executed, hence before ini_set could change the error reporting configuration.

Check out these pages for some solutions:

answered Mar 26, 2010 at 20:41
0

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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.