Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I'm running ubuntu 10.04 + nginx + php-fpm 5.4

If I set display_errors = On in php.ini all errors are printed. If Instead I set that to off and then use ini_set('display_errors, '1'); directly in the script they will show as well but not the parse errors, just a blank page. I tried to play with error_reporting too and E_STRICT but I couldn't find a way!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
281 views
Welcome To Ask or Share your Answers For Others

1 Answer

If you disable display_errors in php.ini, and later enable it in your PHP script using ini_set(), it will only be enabled after the line containing that ini_set() call has been executed.

Parse errors occur before the PHP script even starts -- when the PHP file is parsed (hence the "parse error" name).

Which means they occur before your ini_set() has even a chance of being executed -- which means that, in your case, display_errors is not enabled when the parse error occurs ; and, as a consequence, you don't get anything displayed.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...