Alex Rivera | Logout

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

Asked 2009-12-22T04:06:06.997
17

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.

Edit
Report

3 Answers

2

The most likely thing here is that apache is crashing. Look through the apache error log maybe, or attach a debugger.

Details on looking debugging the apache/php process on windows can be found at http://bugs.php.net/bugs-generating-backtrace-win32.php

answered 2009-12-22T05:23:20.360
2

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.

answered 2009-12-22T23:09:18.027
1

To activate error display in your PHP code in case you don't see anything, insert

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

Example where this potentialy saves you a lot of time:

This code in a joomla default.php template file displays a blank page with no error msg without lines 20 and 21

17  <?php if ($params->get('title_article_linkable')) { ?>
18      <a href="<?php 
19          $url = JRoute::_(ContentHelperRoute::getArticleRoute($item->id,$item->catid));
20          ini_set('display_errors',1);
21          error_reporting(E_ALL);
22          echo $url; ?>">
23      <?php echo $this->item->title; ?></a> // should be $item->title !!
24  <?phpLL000000 } else { ?>
25      <?php echo $item->title; ?>
26  <?php } ?>

Output:

enter image description here

answered 2013-02-09T23:55:41.900

Your Answer