How to fix blank screen or White Screen of Death?

One of the common symptom being seen during PHP development is White Screen of Death, a blank screen instead of expected page. If you "View Source" on white page, it will often contains no title, no header or body and there are no errors - a simple blank page.

As described in PHP Errors article, blank page is caused from PHP syntax error(s). PHP Errors are caught during run-time, but syntax errors are caught before execution and due to errors in syntax the script never runs. Syntax errors and Fatal errors are displayed on the screen if you set the display_errors at the server level by editing php.ini file.

The most common reason for resulting in white screen is syntax error, missing a character somewhere in your code. A missed single-quote ', curly brace }, or semicolon ; will produce blank screen with no errors. The best way to resolve this is to turn on error_reporting at the server level (php.ini) or folder level (.htaccess), and find exact location of syntax error(s). Also, using a color-coded PHP Editors like Eclipse, Dreamweaver, or Komodo IDE will help identify the problem even before running the script.

A brute force way to isolate this issue is to commenting out a block of code at a time to see if the problem goes away. This is not very intuitive way to resolve the issue, but if all else fails this approach may actually work.

Wordpress Site - White Screen of Death

For wordpress sites, the most common cause of blank screen are (1) compatibility issue with a plug-in, or (2) mis-configured theme.

(1) For plug-in problem, if you have access to Admin Panel you may deactivate all of your plugins, and then reactive them one at a time. If Admin Panel is also blank, you may want to move wp-content/plugins folder to something else, create an empty wp-conten/plugins folder and then move one plugin folder at a time back to plugins folder.

(2) For theme problem, if you have access to Admin Panel you may switch to another theme and isolate the problem. If your Admin Panel is also blank, you'll have to play with wp-content/themes folder.

Tags: 

Comments

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.