Friday 1 December 2017

debugging - How do I debug a PHP WSOD?

itemprop="text">

Very occasionally I get a mystifying
white-screen-of-death PHP error - nothing is displayed or logged, even with the
following
settings:




ini_set("error_reporting",E_ALL);
ini_set("display_errors",true);
ini_set("log_errors",true);
ini_set("display_startup_errors",true);
ini_set("html_errors",false);
ini_set("error_log","/var/log/php_error_log");


I
read somewhere that output buffering or memory limit errors can result in no error
output, but previously (for example) I have found a WSOD simply caused by __autoload()
looking for a missing class file.



Has anyone
found a way to get these errors visible? I hate commenting out blocks of
code.



Thanks



Answer




I had a similar problem recently and it
turned out that the software package I was using was overriding the logging settings so
that I was never seeing the logs in certain situations. Because your putting the
settings in the ini file, i'm guessing your using php.ini, there is a lot of opportunity
that something closer to where the code is run is changing the
settings.



My advice would be to put
error_reporting(E_ALL | E_STRICT); in the file that is causing
the problem and see if that improves things.



No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...