Tuesday, July 30, 2013

Fix ‘Blank page’ problem aka White Screen of Death

This is another interesting problem that baffles the novice PHP programmers.

We make a quick change, and upload the file to webserver, we access the webapge and your are presented with a blank white page, aka ‘white screen of death’. It does not even show any error message.

We end up thinking what happened, we refresh the webpage but usually nothing changes.

Why this happens?
This happens because your host has switched off error reporting(for good reasons). So whenever their is a fatal error in your PHP script, and you have error reporting turned off you are presented with white screen of death.
So how to remedy it?
Their are two ways to get out of this situation,

Changes in php.ini file
If you can have access to php.ini file then change the display error property to On.

display_errors = On
Also make sure that error reporting property is at least set to

error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT
Changes in the file
In case where you don’t have access to php.ini file, you can set these property in PHP script itself. Simply add following at the very start of your PHP script

If you are using some, open source package like Drupal, Joomla or WordPress then put these codes in the index.php file in the root directory, right at top.

It is also possible that even though you see a blank page, but when you view the source you see the whole html code. This happens when you might miss proper closing an html tag, like <script>,<object> etc.

Please note that white screen of death can also happen due to problems in your Internet connectivity, this usually remedies itself when you do a page refresh.


1 comment:

  1. Attractive section of content. I just stumbled upon your web site and in accession capital to assert that I
    acquire actually enjoyed account your blog posts.
    Anyway I'll be subscribing to your augment and even I achievement you access
    consistently fast.