phpwsod

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


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.


Solution

  • I guessed the answer to this problem - it turns out that PHP 5.2.5 can't handle a recursive death.

    <?php
    
    class A
    {
        public function __construct()
        {
            new B;
        }
    }
    
    class B 
    {
        public function __construct()
        {
            new A;
        }
    }
    
    new A;
    
    print 'Loaded Class A';
    

    No headers, errors, content, logs, xdebug dumps, memory spikes, CPU spikes, server crashes, or anything. After about 150ms PHP just "ends". Weird.