is this your homework?

Flunking social studies.

email icon
twitter icon
rss icon
How to Fix the Wordpress

How to Fix the WordPress “White Screen of Death”

October 11, 2012 |  by  |  Tech

A problem has been bugging me for quite a while now. Occasionally when working within the WordPress admin pages, checking the stats, updating posts, etc, a blank, all white page will be returned. When this happens the following error is output to the logs.

PHP Fatal error: Out of memory (allocated 42467328) (tried to allocate 67105 bytes) in (docroot)/wp-content/plugins/jetpack/modules/stats.php on line 448

If you’ll notice, WordPress isn’t exactly asking for the moon. It’s using about 40MB of memory, and only asking for 70KB more. Surely, I should be well in the clear with this, especially since I’ve configured every memory setting I can think of upwards of 256MB.

This is a pretty common problem with the PHP script serving the WordPress site requiring more memory than is available or allowed. There are a number of suggested fixes, described below, but none worked for me, and I managed to simply work around the issue (by deactivating plugins) for quite a while. This wasn’t altogether satisfactory, and today I had no ‘superfluous’ plugins to deactivate, so I dug deeper into the world of hosting and PHP multi-user configuration.

Thankfully, I found the silver bullet, and have (hopefully) banished the White Screen of Death forever. If you’ve encountered the same problem, simply follow the steps below to solve the issue.

Step 1: Disable Plugins

This is the least helpful solution. But, if you are running out of memory, you can try simply using less memory. Once you’ve pared down your plugins to the minimum that you require, you’re going to have to actively increase the memory available to WordPress and/or PHP.

Step 2: Increase the WordPress Memory Limit

The next step is to check your wp-config.php file to ensure that WordPress is permitting itself enough memory. If this is the problem, you won’t be getting PHP fatal errors, but it may still present itself with the White Screen of Death. To increase the WordPress memory limit, add the following line to your wp-config.php file.

define('WP_MEMORY_LIMIT', '256M');

256MB is more than enough for any WP site, but this will help diagnose where the issue lays. You may want to dial this back after things are working right. If that still doesn’t do the trick, it’s time to make sure that your server’s PHP memory limit is sufficient.

Step 3: Increase the Server PHP Memory Limit

You may not have access to your server’s PHP settings. So, to check and see what the memory limit is, you need to run a PHP Info utility. You can simply install the “PHP Server Info” plugin which displays the phpinfo() on a page in your admin screen. However, if you’re running into memory problems and can’t install another plugin, add a file named “phpinfo.php” to your WordPress document root with the following contents. Important: Be sure to delete this file after you’re finished, it’s not something you want publicly accessible.


<?php
// Show all information, defaults to INFO_ALL
phpinfo();
?>

Point your browser at http:///phpinfo.php, or go to the PHP Info plugin page in your WP admin pages and you’ll see the full text of the PHP configuration. Look for the line memory_limit, and check to see if it’s too low.

If yours is set to 16M or 32M, then this could be the culprit. You may want to bump it up to 256M while you’re troubleshooting, and find a suitable value once you’ve solved the problem. You can change this setting by editing or adding the following line in your server’s PHP.ini file (you may have to have your hosts do this).

memory_limit = 256M;

On my server, the PHP memory limit was set to 128M, which again is more than enough for the 40MB that I needed. Unfortunately, there didn’t seem to be any other solutions that I could try. As a result, I simply avoided the problem by disabling some plugins that I wanted, but could live without. This kept my memory usage under 40MB, but it was hardly an ideal solution. When I bumped up against the White Screen of Death again, and was out of plugins I could live without, I sought a proper solution. Fortunately I found it.

Step 4: Increase Server User Memory Limit

After some serious google sleuthing, I discovered that most hosts utilize various tools to limit the memory and CPU that each user can utilize. This makes sense, but naturally, can lead to lower available memory limits than PHP or WordPress thinks they are permitted.

What fixed the problem for me was increasing the Apache RLimitMEM to its max size. This can be set in the Apache configuration files or in your server’s .htaccess file. I didn’t have access to the Apache config files on my server, but I was able to access the .htaccess file. You may need to contact your host to do this.

To increase the amount of memory available to your hosting server user, simply modify or add the following line to your .htaccess file.

RLimitMEM max

Once I added that line, like magic, my White Screen of Death issues have disappeared. My WordPress install had been throttled by a somewhat obscure Apache setting, but now it was free to stretch its legs a bit. Hopefully this will work for you, and finally enable your true WordPress potential.

Install All the Plugins

Edit: I’ve also discovered, this fixes the following https/cert error when trying to upgrade WordPress or install a plugin:

Download failed. error setting certificate verify locations: CAfile:
/[wordpress-location]/wp-includes/certificates/ca-
bundle.crt CApath: /etc/ssl/certs

After encountering the above error, and working with my host to exhaust all the potential cert-specific issues (cert validity, permissions in wordpress and /etc directories, et cetera…). Finally, I realized this was only occurring on one of the sites on my hosting environment, while working fine on my main sites. I tried setting the RLimitMEM to max, and it did the trick.    

More Information


6 Comments


  1. Thanks a LOT lot lot

    I was several days to find this solution. The Key was “To increase the amount of memory available to your hosting server user, simply modify or add the following line to your .htaccess file.

    RLimitMEM max

    Thanks again and very success for you

  2. Thank you! THANK YOU!

    Finally the final solution to what seems to be a common problem.

  3. thanks very much! after searching the web for a fix, this is the most exhaustive article i found on this issue.

  4. Thanks a lot! The “RLimitMEM max” line to .htaccess saved me a lot of effort.

  5. Years later and this has helped me a great deal!
    Thank you so much!

  6. Saved my life!

    For weeks fighting with host services, today 4 hours trying to explain that all possible memory config was set.

    “RLimitMEM max” comes to save the day!

Trackbacks

  1. Yes! I have my blog back! | Savage Pink

Leave a Reply