1. Computing

Discuss in my forum

Angela Bradley

The White Screen of Death

By , About.com GuideJune 6, 2006

Follow me on:

Everyone is familiar with the famous 'Blue Screen of Death'... well in PHP sometimes you get what I affectionately call the 'White Screen of Death'. This is when your page simply displays nothing. No title, no content, no helpful error to tell you what went wrong, just nothing. Viewing the source shows... you guessed it... nothing but a blank file. Here are some tips to help new programmers pick out the problem.
Comments
June 7, 2006 at 8:46 am
(1) Justin says:

I hate it when that happens, but I find a colour coded editor helps alot.

May 5, 2007 at 5:18 pm
(2) Fred says:

Isn’t there some way to look at a log to see what the problem was?

October 4, 2007 at 8:54 pm
(3) Philipp says:

An alternative to commenting out large chunks of code is the liberal use of die(); statements, as they get executed before the error, but not after the error occurred. Especially helpful if the colour-coding gets confused

@Fred: Unfortunately no. That’s what makes these errors so frustrating

October 28, 2009 at 7:38 pm
(4) Ben says:

The white screen of death is often caused by PHP’s output buffer being overrun – or the exhaustion of memory through buffer us.
If php generates an error in a loop, and that error grows and grows and grows the output buffer freaks out – and it dies before it can dump anything. Disabling output buffering should always be the first step to testing your script. Then use the command line php -l to make sure it says your script is free of errors. Then start placing die() or better yet ‘exit’ statements in your script.
Another excellent debugging method is to run the script from the command line.

Usually the white screen of death originates from errors that are happening within loops.

Please also note that another common reason for the white screen of death is the having curly braces { } where they don’t belong – like in the middle of a statement – this causes the compiler in PHP 5.2 – 5.3 to fail in such a way that it does not generate errors.
I consider this a bug and hope they fix this crap in 6.0!

Leave a Comment

Line and paragraph breaks are automatic. Some HTML allowed: <a href="" title="">, <b>, <i>, <strike>

©2013 About.com. All rights reserved.