Tag Archives: fix

WordPress – The ‘white screen of death’ and how to avoid it.

The ‘white screen of death’ is something that you have come across in either trying to customise your site or you wouldn’t have come here for answers!

On a brand new installation of WordPress it can be extremely annoying to suddenly find that your site doesn’t work. The actual site may be online, but it isn’t much good if the first post simply says ‘Hello world!’ and you can’t change it, or worse still you can’t see anything!

So what causes this?

Problem 1

Well I’ve had the same problem twice with the same installation. The first solution was reasonably simple to fix. The mod_security() settings server side needed changed. This can be done very quickly by your host (assuming they have a dedicated support team and it isn’t a bedroom reseller host) and will resolve the white screen issue in minutes. They simply need to add your domain to their server whitelist.

WordPress doesn’t tell you what the error is by default, but you can force it to provide error messages so at least you know where the error occurs in scripting.

The first thing to do is to create a log file. Do this by creating a file called debug.log in the /wp-content/ folder.

You then need to modify the wp-config.php file to include the following three lines.

define (‘WP_DEBUG’, true);  // Turns on debugging

define(‘WP_DEBUG_DISPLAY’, false); // Set the debugging to NOT display the errors on the live site

define(‘WP_DEBUG_LOG’, true); // Record the errors in a debug log file</code>

 

Make sure that this code is placed before the line which reads             /* That’s all, stop editing! Happy blogging. */ in the wp-config.php file.

This will log all errors and record the actual error in the log file you have created. Although this means you will not see the error message on screen, you will at least be able to track it down and look for further advice when you have found it. The reason for doing it this way is to ensure that error messages are not displayed on the live site. To display the errors in real time (I used this while the site was in dev and therefore not public facing) then simply change the display flag to true.

Problem 2

The second error wasn’t so easy to track down. It manifests itself in exactly the same way when you click ‘customise my site’ from the dashboard, and the white screen is all you get. I eventually narrowed this down to the plugins. Plugins can be very useful. I use several (spam trapping, cookie policy display on first visit, contact form) but the way they interact with the main template can be an issue. The fix for this error is REALLY simple.

If you need to customise the site (either through the dashboard or by changing the code) then start by going to the plugins screen from the dashboard and deactivate ALL plugins. Then make the changes you need, and when you have saved all the changes and are ready to log out, go back to the plugins screen and activate all plugins. This should ensure that the white screen doesn’t affect you, and while it means the plugins won’t work for a short time, this is much more preferable then not being able to make any changes at all. This last point is useful for ANY changes, even adding new posts to the site.