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

By Posted 2010 Updated   BloggingWordPress

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.


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

  1. Harsh Agrawal says:

    At times it does n’t work, so here are two work around:
    Edit your php.ini file to increase the memory and if that doesn’t work also, contact your host and ask them to upgrade your memory limit for your hosting account.

  2. Patrice Albertus says:

    Thanks for the tips. But for those people with a provider limiting memory access, and still having problem wi allowed memory size, simply desactivate the plugins during update and it will work fine ;)

    • Ewealths says:

      Deactivating plugins and reactivating them after upgrade would that not after some plugins that require some setting/configuration like All in One SEO, to working properly, would not have to do the seup again after reactivation the plugins?

      • Kimberly Castleberry says:

        There will be a few plugins, usually wp-super cache that need a setting or two looked at after this – however, most plugins store their settings in the wordpress database and deactivating them does NOT harm the settings. Delete removes the settings but deactivation generally preserves them. Definitely want to deactivate theme and plugins to reduce conflicts.
        Kimberly

  3. agritwebid says:

    nice info, but my i know, what is the advantage if we use wp 3.0 with the older… ? i try to update my wp, but, i m scared if my db error n i lost everything (content, themes, links etc). then what should i do if i want to upgrade my wp to 3.0?

    • Kimberly Castleberry says:

      Agritwebid, you shouldn’t be doing an upgrade without a full database and plugin/theme/upload backup at the very least. There’s a lot of good tutorials on the net, maybe even on this blog. On my blog if you search for “backup” you will find mine. Yes, back up all your stuff. Then deactivate theme (by activating the original theme), deactivate your plugins and upgrade without headache usually.
      Kimberly

  4. Adrian says:

    Thank you for your tips.
    ;)

  5. Ulf Karlsson says:

    Thanks for the fix, I needed to change the htacces the other sollutions did not work, but you saved my day :-)

  6. FindSW.com says:

    Thank you for your tips.
    ;)

  7. John says:

    Also, be sure to check line 23 of the /wp-includes/default-constants.php
    This has been the culprit for error problems for me!

  8. AngryTechnician says:

    The wp-config.php setting worked best for me – I was getting this error even when trying to browse to the edit pages menu (on the site in question there are admittedly a lot of pages, but this never happened before 3.0)

    Thanks!

  9. steve says:

    I use NameCheap for hosting. I didn’t have a php.ini file anywhere, and editing .htaccess didn’t work, so I created a basic php.ini file and put it in four public_html folders that I thought might need help: wp-admin, wp-admin/includes, wp-content, wp-includes. I’m not sure where the magic spot was, and I don’t care because it’s working now :)
    The content of the php.ini file was basic:
    [PHP]
    upload_max_filesize = 64M
    memory_limit = 64M
    register_globals = On

  10. Viaje de Novios Argentina says:

    @steve
    man, I have been trying everything. Created that small php.ini fine and worked like a charm! thanks!

  11. Michael says:

    Thanks somuch for helping resolve the memory limit problem i had on my site…

  12. BestDamnStore.com says:

    When in L.A, I owe you a beer. Updating the config file worked and saved several websites for me (too late though for some others that I had to put down because I could not solve the memory issues).
    Thanks

  13. Yogie says:

    Great! it’s work!..

    Thanks man!

  14. Mahesh says:

    I am using a wordpress installation with bbpress plugin installed in it. Most of the time memory usage is around 39 Mb, which is more than allowed 32 MB. But the page still loads and works. Should I change the memory limit to more than 32 MB? My site uses wordpress 3.5 and bbpress 2.0

Leave a Reply

Your email address will not be published. Required fields are marked *




css.php