Knowledge Base Overview
Empty white screen
Created: Last updated:
So, you work on a website and suddenly you are looking at a white screen, a blank page in your browser? No error message, nothing, just emptiness? White silence? Well then here's your answer, read on.
White Screen of Death
What you see what is commonly known as the White Screen of Death (WSOD). So, what happened? First the bad news.
The primary cause is you have an error in your script. This tutorial will not help you with this error but why you cannot see an error message. The cause for this—the white screen—is pretty simple actually and following in this tutorial is how to fix it.
As just explained the initial problem is always the same. Whenever PHP finds a structural error in your script it triggers an error and brings execution of the script to a halt and here's your problem with the white screen. Your error settings tell PHP what to do next, i.e. if it displays an error message or not and what's causing the white screen and needs to be fixed.
The white screen is a result from settings in either the error_reporting or display_error in your current environment. If you saw errors before you may have accidentally changed some settings or you work in a different environment with different settings.
In production you should turn them both off because you should have fixed all structural errors in your scripts, i.e. catch them and show a meaningful error message to the visitor. The visitor should not be bothered with funny looking error messages. In your development environment you must see and get as much as possible, though.
The error_reporting is a configuration setting in your php.ini file but also has its own function to make changes at runtime. The following is the default setting for it
error_reporting(E_ALL ^ E_NOTICE);
This is probably the best for your development environment.
The display_error is a configuration setting you have to set in your php.ini file or at runtime with ini_set. Mind the notes at php.net for display_errors. Setting it at runtime would look like this
If you are working in a development environment you may want to have these two lines fro error_reporting and display_error very early in your index.php script to see and catch errors from the first line on.
Note that this is not a recommended case in your production environment where you actually should do quite the opposite. The Zend Framework has its own handling for this and is next.
Zend Framework Configuration
Here is a special note about the Zend Framework which may be overlooked by many. A lot of tutorials and forums recommend setting the display_errors in the application.ini file. They usually recommend you have two separate settings for development and production.
Within the production section you may have the following line
phpSettings.display_errors = 0
phpSettings.error_reporting = "30711" // in PHP 5.3.x
Note that phpSettings will do the same within Zend as setting the lines above. With the first line we get ini_set(display_error,0) set at run time and the second line is equal to the error_reporting(E_ALL * E_NOTICE). Note that the settings in the Zend configuration require a numeric value for the Predefined Constants.
The setting above will result in a BSOD in your website whenever the script has an fatal error. Although the error_reporting would show such errors the display_error says to show nothing.
This is an important note if you are using Zend Guard, especially the 14-day trial version. If not then never mind but if you have encoded your application with the Zend Guard trial version you should ask yourself if 14 days have passed since you started the evaluation.
Depending on how much you have encoded and how your application configuration looks like you may end up with a white screen instead of an error message.
Once the evaluation is over the pages will trigger an error. If your error management is inside your configuration you will see a blank screen—no funny expiration message.
As an example: In the Zend Framework this error management is usually inside your application.ini configuration file and if any file of your application is encoded before that error management is implemented you won't see an error.
If you have more questions surrounding Zend Guard check out the Zend Guard section in my Knowledge Base. Now on to the "simple" problems giving you a blank, empty and white screen of death plus a headache for free.
Because this problem is a thing with PHP it can happen with all sorts of platforms or frameworks. For you it may be the Zend Framework but actually you might run into the same problem when you develop for WordPress, Joomla, Drupal or whatever you use as your content management system.