How to fix blank screen or White Screen of Death in PHP?

One of the common symptoms being seen during PHP development is White Screen of Death, a blank screen instead of an expected page. If you "View Source" on a white page, it will often contain 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 a white screen is a 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 the exact location of the syntax error(s). Also, using 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 comment out a block of code at a time to see if the problem goes away. This is not a 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 screens are (1) compatibility issues with a plug-in, or (2) misconfigured theme.

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

(2) For theme problems, 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 the wp-content/themes folder.

Share this post

Comments (0)

    No comment

Leave a comment

All comments are moderated. Spammy and bot submitted comments are deleted. Please submit the comments that are helpful to others, and we'll approve your comments. A comment that includes outbound link will only be approved if the content is relevant to the topic, and has some value to our readers.


Login To Post Comment