Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP produces a completely white page, no errors, logs, or headers.

Tags:

php

wsod

While running some PHP code on my private WAMP PC I'm suddenly getting a blank response from the server - no response actually. No headers, no data, nothing in the PHP error logs, nada. I restarted APACHE and PHP but still nothing. I know php is working because I can access other PHP scripts just fine.

Firebug reports no headers, ? bytes, and it only takes 163ms to "load" (so it's not a timeout). I thought about rapid memory consumption - but I monitored my PC's memory and it's not showing any spikes. Errors and Exceptions have been working fine until now.

What in the world?

max_execution_time = 30 ;
max_input_time = 60 ; 
max_input_nesting_level = 64 ; 
memory_limit = 500M ;

error_reporting = E_ALL | E_NOTICE | E_STRICT
display_errors = On
log_errors = On

:EDIT:

I wouldn't touch @ with a ten-foot-pole. I think the ruby guys throw that in there so programmers would drop PHP.

Anyway, I enabled xdebug and it didn't output any grind files. Then I took zombat's advice and placed a DIE() at the top of the page and it worked. I guess that I just have some very weird code that totally kills PHP. Even if errors were disabled or suppressed with @ I should still be getting back a header from the server with the empty content!

If I find more I'll post back.

like image 603
Xeoncross Avatar asked Dec 22 '09 04:12

Xeoncross


3 Answers

Run the page from a console and you'll get the error message.

// nix
php yourFile.php

// Windows
c:\path\to\php.exe yourFile.php
like image 66
Mike B Avatar answered Oct 24 '22 09:10

Mike B


You could have a .htaccess file in this directory which has modified error reporting.

To test, try explicitly setting these options at the top of your php script which is giving you trouble.

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

I've also seen this caused by over-zealous anti-virus packages. Some contain web proxy software to filter internet and email. In that case, the page would just continue load into infinity but never complete.

like image 22
txyoji Avatar answered Oct 24 '22 09:10

txyoji


Beware the @ (error suppression) operator, if you have a syntax error on a line with @ PHP will silently exit.

To detect this condition, use set_error_handler and write your own error handler, you'll still get called for errors where @ is used.

like image 27
Don Neufeld Avatar answered Oct 24 '22 08:10

Don Neufeld