Many people use WordPress on a server for a blog, online stores, and so on.
It’s great software since it makes creating a “fancy website” accessible to those who are not so technically inclined – which is most of us!
There is a problem many people see when using WordPress that has become known as the WSOD, or White Screen of Death. Basically, one day you try to load any page on your WP site (including the admin pages), and all you get is a blank screen.
When this WSOD happens, there is 1 trick that I have found works better than any other…
Okay, two tricks. But it’s the second trick that usually solves the problem.
Some background
Normally, when your site is malfunctioning, you will see some kind of error in your server logs. This makes tracking down the issue much easier.
Alas, with the White Screen of Death, what’s often happening is a “500 Server Error”, which means, “Sweet Sassy Molassey, something went seriously wrong, but I dunno what!”
The trouble with the WSOD is that in certain cases, you won’t even get a message in your server’s error log. In fact, you’ll get nothing at all…
That makes it kind of hard to fix, eh?
Trick #1: Debug Mode
The first thing you’ll want to do is FTP or SSH into your server or hosting company, and modify the file wp-config.php in the base directory of your site.
Before the first line that is NOT a comment, insert this:
define( 'WP_DEBUG', true );
Once you’ve edited the wp-config.php and added this line, try loading your site again.
If you see any displayed error messages, you now know where to look to fix the problem. When you’re done fixing, remove the WP_DEBUG entry.
Usually, this trick doesn’t work for me with the WSOD. That’s where the next trick comes in…
Trick #2: WP_MEMORY_LIMIT
If the WP_DEBUG trick didn’t work, go and edit your wp-config.php again.
Delete the WP_DEBUG line you just inserted earlier, and replace it with this:
define( 'WP_MEMORY_LIMIT', '64M' );
Try to load your site again.
If that didn’t work, bump the value up a little higher, say to 70M, 80M, 90M, etc.
Normally, this will fix your White Screen of Death.
Why WP_MEMORY_LIMIT works
It turns out that by default, WordPress sets the PHP Memory limit to 40MB by default (64MB if you’re using WP multisite).
For whatever reason, this isn’t enough memory for PHP to fire up your site, so you get the WSOD.
From the WordPress Codex:
Also released with Version 2.5, the WP_MEMORY_LIMIT option allows you to specify the maximum amount of memory that can be consumed by PHP. This setting may be necessary in the event you receive a message such as “Allowed memory size of xxxxxx bytes exhausted”.
This setting increases PHP Memory only for WordPress, not other applications. By default, WordPress will attempt to increase memory allocated to PHP to 40MB (code is at the beginning of /wp-includes/default-constants.php) for single site and 64MB for multisite, so the setting in wp-config.php should reflect something higher than 40MB or 64MB depending on your setup.
WordPress will automatically check if PHP has been allocated less memory than the entered value before utilizing this function. For example, if PHP has been allocated 64MB, there is no need to set this value to 64M as WordPress will automatically use all 64MB if need be.
By manually increasing the WP_MEMORY_LIMIT variable above 40MB, POOF! Your site works again. You’re just telling WP that it can use more memory when doing PHP stuff. Oh, and ignore the last paragraph, because that doesn’t seem to be true all the time…
Note that this can happen out of the blue, like say when your hosting company upgrades some stuff that really shouldn’t cause any problems for you. It’s a bit of a pain like that.
If you’re host is using cPanel, the WSOD can appear if the hosting company simply switches from EasyApache 3 to EasyApache 4 – even if the config for EA4 is identical to that of EA3! Since EA3 is on its way out, I suspect more and more people will be seeing this issue. Fun times, eh?
Also, be aware that there may not seem to be any rhyme or reason to this WSOD problem. You can have a plain vanilla WP site that WSODs on you, and yet another site with way more plugins, posts, or whatever runs just fine without WP_MEMORY_LIMIT tweaking.
It’s a bit of a mystery, but the fix works.
Still not working…
You may need to actually increase PHP’s memory limit on your server before you can set WP_MEMORY_LIMIT to a higher value.
If you manage your own server, edit php.ini. If you’re using a hosting provider, you can contact them for instructions on how to do this (or they usually have online help docs that tell you what to do).
For most hosting companies these days, the memory limit of PHP itself is set fairly high.
For example, DreamHost has a default PHP memory limit of 90MB, so you can safely increase WP_MEMORY_LIMIT up to 90MB. That should be more than enough!
GoDaddy‘s cPanel hosting appears to be 64MB at the time of writing, but you can manually increase it yourself from your control panel. See their help pages for more info.
Check with your specific host to see about your current PHP mem limit setting, and how to raise it if necessary. Then your new WP_MEMORY_LIMIT setting will work.
Recent Comments