Fix “Allowed Memory Size Exhausted” Errors with WordPress 3.0 Upgrade

A lot of people upgrading to WordPress 3.0 are encountering “Fatal error: Allowed memory size exhausted” errors on their blog and the upgrade fails. There are some solutions which WordPress experts suggest.

“Allowed Memory Size Exhausted” Errors

This is how typically the error looks like –  Fatal error: Allowed memory size of 33554432 bytes exhausted

Why does this happen? Web reports indicate that the size of the download package for WordPress 3.0 is larger than previous versions (due to merger with WordPress MU and new Twenty Ten theme), due to which WordPress needs more memory to download the larger file. Since most web servers have set limit upto 32MB, whenever this is exceeded, the errors occur.

Fix “Allowed Memory Size Exhausted” Errors in WordPress 3

Here are some solutions which WordPress experts suggest.

  • Login your server via FTP (I prefer Filezilla)
  • Download wp-config.php located in the root of your WordPress install
  • Edit it using a text editor like Notepad
  • Add this line after after the <?php tag
    define('WP_MEMORY_LIMIT', '64M');
  • Upload and replace wp-config.php file

All should we working fine now. You can also choose  a value higher than 64 like 128M, but 64 should do the trick. Always keep a backup of the original wp-config.php file incase something goes wrong.

Update: Here is another suggested fix – locate your php.ini file (if it exists), and if it shows 32M, change to 64M:
memory_limit = 64M ; Maximum amount of memory a script may consume (64MB)

But if you don’t have access to PHP.ini try adding this to an .htaccess file:
php_value memory_limit 64M

If all these steps do not work? Then your web hosting provider may have prevented PHP from increasing the memory limit, and you can contact your webhosting support to increase the memory limit for your server.

Use a WordPress PluginMemory Bump is a simple WordPress plugin which can add this line to your wp-config.php file (with 256MB limit) automatically, no PHP file editing manually required. Simply install and activate the WordPress plugin, and the memory limit error will go away (again only if your hosting allows PHP to raise the limit on your account), then you can deactivate once done.

I think WordPress needs to address this memory issue soon, by reducing the package as much as possible, as it will be affecting thousands of WordPress bloggers upgrading WordPress on shared hosting servers.

Share with friends

About the Author: P Chandra is editor of QOT, one of India's earliest tech bloggers since 2004. A tech enthusiast with expertise in coding, WordPress, web tools, SEO and DIY hacks.