08.07.08
Solution to Wordpress Blank Screen of Death
As I posted last week, getting my blog hacked forced a wordpress upgrade to v2.5.1 however it also caused a problem I had previously been unaware of, the Wordpress Blank Screen of Death. This is basically where under some circumstances, you get a blank plain white screen instead of the page you were looking for. In my case, I was completely locked out of the admin screens and could do nothing with the blog apart from post comments!
This post is going to take you on a journey, one that starts with following standard debugging techniques that I’ve learned from years of experience in the IT industry and ends in a discovery so surprising, it’s made me question the fundamental quality of the whole blogging phenomena that is Wordpress (Wordpress is the blogging software this blog uses and is arguably one of the most popular). I started off as anyone should when faced with a new and unfamiliar problem, by doing some research:
What I found was that this appears to be a common Wordpress problem suffered by many bloggers and can arise in many possible situations e.g.:
- After writing a comment and clicking Submit.
- Accessing any of the main blog screens.
- Accessing any of the administrator screens.
- After *doing* something in the administrator screens.
During the upgrade, I noticed I was suffering from (4) above. I could access the admin pages no problem, but whenever I tried to do anything adminy I’d get the Blank Screen of Death e.g. change a plugin setting or write a post or change anything. The action I was performing worked ok, but I’d have to hit the back button and do an F5 Refresh to see the results of it. At the time I figured I’d deal with it later.
It was made worse because there were no error messages: No errors on the wordpress white screen of course; nothing in the main wordpress error.log; nothing in the plugin error log; and nothing in the webserver apache error log. And in the absence of any information it’s a tough problem to debug. However, with my advanced level Google Foo, I was pretty confident of finding the answer. I did in the end, but it took me hours!
Here are all the causes and working solutions I found on the net that others have specified:
- A partially complete upgrade - Solution: Re-upload the upgrade files.
- FTP Client making a mess of the upgrade - Solution: Get a better FTP client and re-upload the upgrade files.
- Something failed running /wp-admin/upgrade.php upgrade script - Solution: Find out what failed (check logs), fix it and re-upgrade.
- Incompatible Plugin Enabled - Solution: Disable all plugins, then add them back one at a time to see which one causes the problem.
- Adding the new define(’SECRET_KEY’,… parameter into wp-config.php - Solution: Don’t put it at the end of your file, put it before the line that says /* That’s all, stop editing! Happy blogging. */
Working down this list posed a problem: How could I disable the plugins without access to the admin screens?!? In the end I had to manually hack the MySQL database directly via the back end. In short, here’s what I did:
- Accessed my webserver admin screens, cPanel in this case.
- Accessed the phpMyAdmin MySQL user interface.
- Browse the wp_options table.
- Find the field called: active_plugins.
- If you just want to look without the risk of cocking it up, here’s the SQL you need:
- SELECT option_value FROM wp_options WHERE option_name = ‘active_plugins’ LIMIT 1;
- First things first before you go fiddling: BACK UP THE VALUE OF THIS FIELD by copying to a text file on your PC.
- Then either us phpMyAdmin to blank the value of the active_plugins field, or use this SQL:
- UPDATE wp_options SET option_value = ” WHERE option_name = ‘active_plugins’;
- Just to be clear here, if you don’t know what you’re doing, then don’t do it! I’m not responsible for you messing up your blog even more. You should have regular backups and have proven to yourself that they work and you are competent enough to restore from those backups.
Anyway, that will disable all your plugins… great. Just one problem: it didn’t fix my Blank Screen problem!
I’ll cut a long story short, as it did take me another hour or 2 to finally find the solution. Now what I’m about to say is a complete shocker to me. As an experienced IT person, someone who has been messing around with and programming computers and working on IT projects in every possible role up to IT Director for over a decade, I am completely dumb founded by what I’m about to describe, because how the human race has got to 2008 with all the technologically related advances we have made, and yet still introduce a hugely powerful and popular program like WordPress, that is brought to it’s knees by the most innocuous of things… it’s just completely beyond me.
Anyway here is the answer: it lies in the wp-config.php file, this is the file where you set your database password etc (so you’ll forgive me for not using my own real one.
). This is the example file that comes with the installation:
— File Starts —
<?php
// ** MySQL settings ** //
define(’DB_NAME’, ‘putyourdbnamehere’); // The name of the database
define(’DB_USER’, ‘usernamehere’); // Your MySQL username
define(’DB_PASSWORD’, ‘yourpasswordhere’); // …and password
define(’DB_HOST’, ‘localhost’); // 99% chance you won’t need to change this value
define(’DB_CHARSET’, ‘utf8′);
define(’DB_COLLATE’, ”);// Change SECRET_KEY to a unique phrase. You won’t have to remember it later,
// so make it long and complicated. You can visit http://api.wordpress.org/secret-key/1.0/
// to get a secret key generated for you, or just make something up.
define(’SECRET_KEY’, ‘put your unique phrase here’); // Change this to a unique phrase.// You can have multiple installations in one database if you give each a unique prefix
$table_prefix = ‘wp_’; // Only numbers, letters, and underscores please!// Change this to localize WordPress. A corresponding MO file for the
// chosen language must be installed to wp-content/languages.
// For example, install de.mo to wp-content/languages and set WPLANG to ‘de’
// to enable German language support.
define (’WPLANG’, ”);/* That’s all, stop editing! Happy blogging. */
define(’ABSPATH’, dirname(__FILE__).’/');
require_once(ABSPATH.’wp-settings.php’);
?>
— File Ends —
That is a perfectly fine, normal and working wp-config.php. Now I’m going to show you a broken one. One so terribly horrendously broken, that it causes you to be locked out of your workdpress blog for half a week and lose 1/2 a day trying to solve it. See if you can spot the difference:
— File Starts —
<?php
// ** MySQL settings ** //
define(’DB_NAME’, ‘putyourdbnamehere’); // The name of the database
define(’DB_USER’, ‘usernamehere’); // Your MySQL username
define(’DB_PASSWORD’, ‘yourpasswordhere’); // …and password
define(’DB_HOST’, ‘localhost’); // 99% chance you won’t need to change this value
define(’DB_CHARSET’, ‘utf8′);
define(’DB_COLLATE’, ”);// Change SECRET_KEY to a unique phrase. You won’t have to remember it later,
// so make it long and complicated. You can visit http://api.wordpress.org/secret-key/1.0/
// to get a secret key generated for you, or just make something up.
define(’SECRET_KEY’, ‘put your unique phrase here’); // Change this to a unique phrase.// You can have multiple installations in one database if you give each a unique prefix
$table_prefix = ‘wp_’; // Only numbers, letters, and underscores please!// Change this to localize WordPress. A corresponding MO file for the
// chosen language must be installed to wp-content/languages.
// For example, install de.mo to wp-content/languages and set WPLANG to ‘de’
// to enable German language support.
define (’WPLANG’, ”);/* That’s all, stop editing! Happy blogging. */
define(’ABSPATH’, dirname(__FILE__).’/');
require_once(ABSPATH.’wp-settings.php’);
?>— File Ends —
What do you think, can you see it the mistake that breaks the whole blog? No? Go back and look closely…
Still no? Ok ok, I’ll give it to you, here’s the problem:
What? You can’t see that either? Let me show it to you again, look carefully this time:
You getting it yet? Yep, it’s an empty line. That’s all it is. 1 single solitary NewLine at the bottom off the file, right after that ?> a Carriage Return & Line Feed in programmers speak. That’s it. You hit the Enter key in one wrong place and the whole pack of cards comes tumbling down! Shocking, just shocking. Let me be crystal clear, it’s this bit here:
?>
— File Ends —
Now of course, the Analyst in me wants to know how this happened and I’ll tell you. The issue was the the new define(’SECRET_KEY’… entry I mentioned before. That should have been my warning, because when I was following the upgrade instructions, they don’t tell you where to put it, so naturally I first put it at the end of the file…. yep you guessed it: AFTER the ?> . I realise now of course that was stupid and it didn’t work. What was the symptom of it not working? You guessed it: the Wordpress Blank Screen of Death.
But when I moved it to the correct place, I was still sporadically getting problems, then I commented the line out and basically with all the changes I made I seemed to have got myself into the situation where I was getting the problem, but only half the time. I reckon the currently open admin session I had going was probably masking half of the issue from me. But in putting it at the end of the wp-config file and then moving it, I must have left behind an empty line. How silly of me! So just make sure you have no extraneous characters after the ?> I’d recommend checking for those evil and nefarious spaces too.
Anyway, that’s the fix and probably the most comprehensive study of getting wordpress blank screens anywhere on the net. Do me favour, if you find this post useful, I’d appreciate a pingback or comment.
Cheers.






STOP SPAMMING THE FORUMS said,
July 8, 2008 at 8:33 am
WTF? a cpl times is fine. GET A FCKING GRIP.
Diane Vigil said,
July 8, 2008 at 11:49 am
Yep. That falls under the “stuff happens” scenario. Been there.
Roanoke VA real estate said,
July 8, 2008 at 6:54 pm
Dude, bless you. You just saved me a lot of friggin hassle. I guess my google foo helped me fine you! Cheers and many thanks!
Charco said,
July 9, 2008 at 12:49 pm
bloody brilliant - I just spent the best half of eight hours trying to sort this out. I’ve been in and out of the database, up and down the MySQL and permissions ladder…
All I can say is THANK YOU VERY MUCH
Kathy said,
July 10, 2008 at 12:50 am
I’m getting the blank screen problems after editing/managing/creating a ‘page’ (but I can post a regular entry just fine) - but I’ve never done the secret key bit… but the repair is usually replacing the wp-config.php file just as you describe. I’ll watch for an extra empty line, but it doesn’t make any sense to me. Great work, though!
Colin McNulty said,
July 11, 2008 at 7:00 am
> STOP SPAMMING THE FORUMS
Dude, when I was trying to find the solution to my own problem, I went through the Wordpress forums in detail and found many MANY people with the same problem and hardly a soul helping them. I resolved to go back when I was done and post replies to all the people that needed help but hadn’t received it.
If I was spamming the forums I’m sorry, but I wouldn’t have needed to if so many people hadn’t had the same problem and not received help from anyone else.
jasper said,
July 11, 2008 at 7:44 am
man i have this same problem at my website..
http://www.maddecent.com
if anyone can help us solve it we can compensate
thanks!
jasper.goggins@gmail.com;
Alex said,
July 12, 2008 at 11:30 pm
Hiya,
I have the same problem, but after first install… not much help from wordpress support forum (instead of a reply, one of their lovely moderators closed my thread because he’d mistaken me for another user).
I had a look for that infamous last line and sure enough, it was there. Removed it, still no joy.
Any ideas where the bug could be? I use Dreamweaver’s built in http://ftp.
Thank you!
Colin McNulty said,
July 13, 2008 at 8:51 am
Jasper and Alex, I would suggest a reinstall / re-upgrade process. There are many things that could be wrong, just start again and work through slowly.
Lee said,
July 15, 2008 at 4:49 am
I’m having this problem when I try to run install.php. I have tried completely reinstalling from a fresh installation without any luck (two or theree times). I have also tried your suggestion, but it didn’t work for me. Also, I have made the following observations:
1) The original wp-config-sample.php file has the extra carriage return at the end! So this is very unlikely to be the real cause of the problem, and as I said, it didn’t work for me.
2) I have PHP error logging enabled, and I got the following error each time I loaded install.php:
PHP Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in [URL removed for security reasons]/wp-admin/includes/media.php on line 154
Hence, the problem would actually appear to be with /includes/media.php.
Interestingly, line 154 is blank - just a carriage return. I’m going to try removing it and see what happens. Or maybe there’s supposed to be an “else” or something there. Any PHP experts here?
Anyway, it appears there is some kind of error in the 2.5.1 version of /includes/media.php.
Lee said,
July 15, 2008 at 8:58 am
Well, I’ve been messing around with 2.5, 2.5.1 and the just released 2.6, and no matter what I do, when I try to install any of them, I get the same blank screen and the same PHP error from /wp-admin/includes/media.php. The only difference with 2.6 is that the error now occurs on line 197 (I’ve discovered that my text editor counts the lines differently from WP, so I’m no longer sure which line this actually is).
However, I noticed 2.3.3 and earlier didn’t have this file, so I decided to try installing it. Voila! It works!
So I was obviously installing it correctly, but there is clearly a serious bug in the code of /wp-admin/includes/media.php (from WordPress 2.5 upwards).
As this file relates to the new admin interface, it explains why some people are getting blank admin screens after upgrading to 2.5 and later, while other people (like me) simply can’t install it in the first place.
I am going to need some very serious convincing that this bug has been fixed before I even consider “upgrading” to a newer WordPress version.
2.3.3 has the extra carriage return at the end of wp-config-sample.php BTW, so I am quite convinced tha this is not the real cause of this issue.
Colin McNulty said,
July 15, 2008 at 7:28 pm
The plot thickens…
To be honest there are always going to be sporadic problems with an install base as large as WordPress, but the lack of error reporting and handling is a shame.
Laowai Chinese 老外中文 » Blog Archive » Sorry for the white out said,
July 17, 2008 at 11:30 pm
[...] you tried to visit in the last 48 hours or so, you would have seen nothing on this site but the White Screen of Death. I just got it sorted out by upgrading to WordPress 2.6, but I have a feeling the addition of the [...]
Michael Liu said,
July 18, 2008 at 9:07 am
Hey Man, You really has done something great, it works.
Simon said,
July 18, 2008 at 6:09 pm
I had my share of blank page distraught.
See my write-up at http://simos.info/blog/archives/706
John Miller said,
July 18, 2008 at 8:26 pm
Not working for me. My wp-config.php file is fine - no extra space, everytime I try to post and click submit, it goes to the …/post.php file and locks up at a blank screen. I thought that maybe is was a chmod permission problem. I’m about ready to just uninstall/reinstall.
Ap said,
July 18, 2008 at 9:54 pm
For what it’s worth: try to set your theme to the base theme. Worked in my case.
hanjra said,
July 18, 2008 at 11:28 pm
Hi, can you please tell me how to deactivate all the plugins in wordpress 2.6. I dont see the above mentioned string (command) in the wp_options table.
My problem is that whenever i try to login, i get blankscreen. I cant do anything to get in. please help me.
hanjra said,
July 19, 2008 at 12:00 am
Thanks god, the problem has been resolved. it was all due to a plugin. I deleted the recently installed plugins using ftp client and now i can login and get into dashbaord.
I am telling this for others help.
Colin McNulty said,
July 20, 2008 at 6:38 am
Plugins are often causes of this problem it seems. One of the things I tried was to move all my plugins out of my plugin folder via http://ftp.
Dan McComb said,
July 20, 2008 at 11:39 pm
Thank you! I lost about an hour trying to figure this bastard out, and after removing the extraneous line break in the wp-config file, it worked all dreamy. You rock.
Marty Martin said,
July 22, 2008 at 4:17 pm
I just started having this problem again today and I notice now that in FTPing to the site, the file has been chown’d to 99 99 instead of the correct owner/group of user1/group1
I wonder if there’s a way to look in the logs and find out what script did that and track the problem that way?
The Book of Brian » Blog Archive » We lived through the dreaded White Screen of Death said,
July 27, 2008 at 4:20 am
[...] as pointed out by Colin McNulty in amazing detail over at his blog (http://www.colinmcnulty.com/blog/2008/07/08/solution-to-wordpress-blank-screen-of-death/), the automated Wordpress upgrade.php script appears to add an extra line in the wp-config.php [...]
Howe said,
August 1, 2008 at 4:05 am
You have a page this size for explaining it was a blank line ?
You must have plenty of time for blogging.
This was a bug, fat waste of time, and of course it didn’t help at all.
The Blog Idea said,
August 1, 2008 at 8:07 am
In my case only a few of the user blogs get blanked. Please suggest.
The Blog Idea said,
August 1, 2008 at 8:14 am
If you click on some of the links to the user created blogs, the pages appear blank.
Kyle said,
August 1, 2008 at 12:24 pm
Thanks for the effort. Reloading all of the files worked like a charm.
WordPress 2.6 upgrade issues and fixes - Adwords articles said,
August 1, 2008 at 12:37 pm
[...] Blog main and admin screens are all white following the upgrade [...]
The Blog Idea said,
August 1, 2008 at 9:24 pm
My problem of blank pages was solved by logging in as admin on my wordpress mu blog and clciking on “upgrade”
Colin McNulty said,
August 2, 2008 at 6:08 am
> Howe said,
> You have a page this size for explaining it was a blank line ?
> You must have plenty of time for blogging.
Not really, but I put effort into subjects that either I care about or bother my greatly. Losing access to my blogs admin screens bothered me greatly.
I also discovered that there were loads of other people out there with the same problem and helping others solve the same problem I’ve solved, is something I care about.
Bengt said,
August 2, 2008 at 9:20 pm
I got blank screens on some of my blogs after upgrading but not on others. It worked with the standard themes like Classic or Sandbox but not with my own themes. My problem turned out to be caused by some extra spaces in those themes functions-files.
Tim said,
August 10, 2008 at 3:22 am
Thank you. Thank you. Thank you. I would have never discovered the problem.
Steve James said,
August 10, 2008 at 3:32 pm
I had the blank screen after comment submit problem. No errors reported, no logs, nothing.
Above, Ap said set the theme back to Default. Out of desperation, I did so, but didn’t expect this to help. What’s the theme got to do with submitting a comment? Well it worked!
I was using the Orange Techno theme; no plugins, fresh 2.6 install. Geesh. Wordpress is a breeze to set-up but the diagnostics are pants.
Niaomi said,
August 13, 2008 at 9:26 pm
I’ve checked my config file and it doen’t have a gap, it isn’t broken. I’ve also delated all my plugins but my screen is still blank after I make changes.
Any help appreciated.
I am so design orientated, I cannot bare this!
Colin McNulty said,
August 14, 2008 at 5:24 pm
As you will have discovered Niaomi, there are many reasons for the Word Press Blank Screen of Death, you just have to keep taking things out till it suddenly starts working.
Sam Hooker said,
August 19, 2008 at 9:15 pm
Pardon my saying so, but isn’t the issue you’re describing more of an issue with the PHP interpreter (Apache mod_php, in your case), rather than the codebase? I mean, it seems like the problem is PHP bailing without sufficient error handling (i.e., posting a message in well-formed HTML to the browser). Sure, it’s sloppy code if the WP upgrade script is appending a spurious newline to the config file, but the greater failing here is that of the interpreter. IMPO, anyway…
Jeremy said,
August 19, 2008 at 9:25 pm
Hi Colin,
Thanks for your write-up. I read your post, and seeing as how you noted that cleaning up the active_plugins field didn’t fix things, I skipped it. Silly me. My problem was IN that active_plugins field. My host actually helped pinpoint it. Not sure how it happened, but the last plugin folder contained in the serialized list had an address that looked like this: ‘../../../../../[about 20 times]../tmpZnlkjP/something…’ …It looked like junk.
I carefully reviewed the entire contents of the field in a text editor, and stripped out that reference. Once I had done so, voilà! My site was back online again.
So if someone else is reading this,
DON’T SKIP DISABLING ACTIVE PLUGINS VIA THIS METHOD OR ANOTHER.
-Jeremy
Sam Hooker said,
August 19, 2008 at 9:48 pm
Colin,
I appreciate your posting, too. Unfortunately, in trying to troubleshoot my upgrade to 2.6.1, the issue was the fact that I hadn’t copied over an alternate theme (into …/wp-content/themes). If folks get this far in your process and are still at a loss, I’d encourage them to look into whether they’ve brought over any alternative themes that may have been in use. Thanks to the folks posting to http://mu.wordpress.org/forums/topic.php?id=9168
Cheers,
-sth
Anthony said,
August 20, 2008 at 10:38 am
My problem started when I installed a few wordpress themes and started testing the look and feel. I lost everything - admin panel- the lot. I cant rem which one caused the blank screen but when I went into the themes folder I just deleted all of the themes bar the default and all was restored.
Jusy incase that helps anyone….