How to Resolve Fatal Error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 30720 bytes)

Sunday, January 18, 2009
By bloggista

Recently, when either adding new plugins or upgrading plugins in Wordpress, I encountered this error message:

Fatal Error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 30720 bytes)…

This means that Wordpress needs more memory to run a process than the default PHP setting (usually 12M, in some, 32M). For a non-techie guy like me, the error is frustrating, and very alarming.

Before you panic, there are actually simple solutions to this problem that even a non-techie person can do. The first solution is the “standard” or proper way to resolve it, however, it depends whether you have access to the file that needs to be updated. The second one is much easier, a “hack” to a specific Wordpress file, however, you may need to do it again everytime you perform a Wordpress upgrade.

Solution 1: Modify your php.ini file

The PHP.INI file can be found in your root directory, usually in /public_html/ directory. That is if your hosting provided you an access to it. In my case, I am using Bluehost/Hostmonster, and it provides you the ability to copy the PHP.INI to your /public_html/ directory then you can make the necessary modifications. Open PHP.INI file and -

Find:


memory_limit = 12M

… change to 32M or higher

Before the new settings could take effect, it “maybe” necessary to restart your webserver.

Solution 2: Add code to your Wordpress /wp-admin/install.php file.

Using your hosting file manager or FTP tool, open your /wp-admin/install.php file and add the following code directly under the <?php tag (usually at the top of the file):


ini_set('memory_limit','32M');

The updated /install.php file should look like this:


ini_set('memory_limit','32M');
/**
* WordPress Installer
* @since unknown
* @var bool
*/
define('WP_INSTALLING', true);

Solution 3. Add this line of code in your Wordpress WP-CONFIG.PHP file. Add it before any other values. (My preferred choice)


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

Try to increase it to 64M if 32M seems to be insufficient. These solutions can also be applied to other PHP-based programs and not just Wordpress.

Did you find this useful? If you think there is a need to modify some of the codes or information on this article to make it more meaningful and helpful, feel free to leave your comment and corrections/updates will be made accordingly.

It will be greatly appreciated.

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • MisterWong
  • Digg
  • del.icio.us
  • StumbleUpon
  • Reddit
  • Facebook
  • Google Bookmarks
  • LinkedIn
  • Mixx
  • Propeller
  • Technorati
  • YahooBuzz
  • email How to Resolve Fatal Error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 30720 bytes)
  • Furl
  • NewsVine
  • SphereIt
  • Sphinn
  • TwitThis
  • YahooMyWeb
  • Blogjoints
  • Bloglines

47 Responses to “How to Resolve Fatal Error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 30720 bytes)”

  1. I just had a plugin error that’s why I am not around for sometime now. :(
    Thanks for the added info..I’ll be back soon once my bloggy errors ends. :)

    Snow´s last blog post..‘Fantasy Island’ Star Ricardo Montalban dies at 88

    Reply

    bloggista Replies:

    ohhh, what errors? Let me know if you need some help.

    bloggista´s last blog post..Filipino honored for inventing low-cost stove

    Reply

    #9846
  2. Same problem i have. It was my Chinese Consultant who fixed it. http://www.kotsengkuba.com and I think he blogged it under http://www.blog-almighty.com hahaha

    Reply

    #9887
  3. I’ve the same problem!
    Thanks, that fixed it for me.

    Reply

    #10841
  4. Thank you so much. I had this issue on 2 of my sites, and this resolved it quickly. I am gonna digg this so other people can find a solution quicker

    Reply

    #10844
  5. Thank you, found this post on google, you saved my life hahahaha…

    Reply

    Pinoy Jobs Online Replies:

    Glad to be of help! ;-)

    Reply

    #11060
  6. Thank you so much for posting this, I didn’t think I’d find anything about this specific error.. I’m really glad you posted these solutions. Increasing the memory limit by editing the install.php worked well for me.

    Reply

    #11198
  7. Will

    I tried the Solution 2…but it doesn’t worked for me…
    What should i do now?

    Reply

    bloggista Replies:

    have you tried Solution 3? Should work in most cases… And make it 64M…

    Reply

    #11511
  8. Bob

    Thank you so much for post it has already fixed a couple of blogs of mine, I’m not really into the code but you showed the how and where to make the changes so that even a code idoit like me could fix it thanks again.

    Reply

    #12099
  9. thanks i was looking for this thing only.

    Reply

    #12148
  10. Tim

    Thanks for this post. It gave me the direction I needed to resolve the issue. Your post explained the issue clearly so that I knew where to look for the problem. My php.ini file was already set to 32M but a particular plugin needed a little more. I edited the memory limit to 64M, updated the plugin, and then set the limit back to 32M. 32M seems a reasonable limit for most scripts. Thanks again.

    Reply

    #12187
  11. thank you so very much. Solution number three did the trick for me when trying to upgrade my WordPress installation.

    Reply

    #12190
  12. Asombrado

    Fantastic!!! Many Thanks

    Reply

    #12213
  13. Krio

    Thank you! The wp-config.php worked for me.

    Reply

    #12242
  14. Chris

    Solution 3 worked well for me!… should we change it back after the upgrade [ie, remove the "define('WP_MEMORY_LIMIT', '64M');" from the wp-config file once we've upgraded]? Or does it matter?… could it have a negative impact on the site in any way if we left it there?

    Reply

    bloggista Replies:

    Hi Chris, great to hear it worked well… Solution 3, being my preferred choice as well, is safer and only affects wordpress install, and not the entire account (if you happen to have multiple domains in you account). There is no problem if you leave it as it is… So you don’t have to do it all over again when new upgrades are released.

    Reply

    #12259
  15. Thanks for this bloggista. Good thing I saw your article via google search. I also have this error on my Wordpress Dashboard. Hopefully, I’d be able to fix this using your solutions.

    Reply

    bloggista Replies:

    Hope this one fixed your problem dude. Thanks for the visit and for the comment. More power to you!

    Reply

    #12270
  16. Thomas

    Solution #1 did not work for me (I also use Bluehost and I changed the php.ini file as instructed, but this did not solve the problem. Maybe like you said, the server needed to be restarted or something? I did not know how to do that or how to request bluehost to do it.

    Solution #2 worked for me. It is also explained on the wordpress website at http://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP

    Thanks!

    Reply

    #12296
  17. ikd

    Let me add my thanks to the several ones already here. Solution no. 3 did the trick for me.

    Best,

    I.

    Reply

    #12320
  18. Thank you! The wp-config.php worked for me.

    Reply

    #12325
  19. Thank you, the third option finally fixed those errors for me, cheers!

    Reply

    #12347
  20. For some reason, I couldn’t find those specific lines of code in any of those three files. I found instructions from WP to edit a different file, and it worked.

    Here:
    http://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP

    This help file recommends making sure that wp-config has the same allocation…except there was no memory limit defined in my config file. Maybe it’s a newer version?

    Reply

    #12410
  21. Solution #3 worked for me as well. The first two led to further errors for some reason, but after going through all of your solutions, things seem to be working better than ever.

    Thank you so much for taking the time to share this information!

    Reply

    #12612
  22. amos

    thanks!! i went for solution nº 3 and it worked pretty easy!

    thanks again.

    Reply

    #12662
  23. Thanks for the workaround. Solution #3 worked for me. When I tried #2 I got another error message about a http.php file.

    Anyway, thanks so much.

    Happy Blogging!
    Kia

    Reply

    #12680
  24. I want to add my thanks. Following the lead of other commenters, I just tried Solution #3 first off. Worked like a charm.

    I shared your post in Google Reader, and will tweet. Interesting blog, BTW.

    Reply

    bloggista Replies:

    Thank you for the comment alaJoAnn. You’re welcome. :-)

    I should update this post to immediately highlight Solution #3 especially for Wordpress users.

    Reply

    #12778
  25. Cheryl from thatgirlisfunny

    Valuable info. It’s so great to have access to an answer before I have the problem.
    I love how your blog shows up on my iPhone. Did you use a plugin or some special coding?

    Reply

    #12780
  26. Wow it feels good to hear in one way or another this post helped. Thanks for the visit and for the comments.

    Reply

    #12808
  27. thank you soo much! its now working!!!!

    Reply

    #12818
  28. Thank you for this fix, easy to do and your instructions were invaluable! Normally wouldn’t take time to comment, but let this be a testament to my relieved frustration!

    Reply

    #13003
  29. Thanks so much! This fixed my problem with the e-commerce plugin I was installing.

    Renee

    Reply

    #13033
  30. I couldn’t get wp e-commerce to work until I did solution three for 128MB.

    Thanks for giving back to the Internet by posting this information!

    Reply

    #13168
  31. More details:
    WordPress 2.9.1 and WP Shopping Cart (AKA WP e-Commerce) 3.7.5.3 was giving me:
    Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 30720 bytes) in /home2/lancerki/public_html/wp-content/plugins/wp-e-commerce/merchants/library/googlerequest.php on line 701

    And I resolved this by using steps 1 AND 3 mentioned in the blog with a setting of 128MB. I’m not certain step 1 was necessary. Step 3 seemed to fix it all.

    Reply

    #13169
  32. Pam

    #3 worked for me. Thank you so much!

    Reply

    #13262
  33. [...] How to Resolve Fatal Error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 30720… saludos! __________________ MixConsolas – Tu portal de videojuegos | Club de Juegos Nintendo | Google Chrome Blog Subasto TeknoAdictos.net – 6.5$ ! [...]

    #13355
  34. Thanks for this. Not sure which solution worked, because I tried all three. But everything’s running like normal now.

    Reply

    bloggista Replies:

    If you are using wordpress, better use SOLUTION 3. Edit the wp-config.php…

    Reply

    #13413
  35. Thank for the info. Warning… when you edit the wp-config.php make sure you edit it using your hosting company (hostmonster/bluehost)or using a nice editing software coz you might end up messing up the code, like i did, using notepad through filezilla. To be on the safe side edit through your hosting account.

    Reply

    bloggista Replies:

    Yeah, don’t ever use notepad or wordpad. It will surely mess up the codes – well most of the time.

    Better use dreamweaver or download a free php editor like Notepad ++.

    Reply

    #13415
  36. You are AWESOME! I did option 3. Worked great!

    Reply

    #13473
  37. Jennifer

    Thanks so much! The first two suggestions did not work for me, but the last one (your favorite) worked like a charm! Yay!

    Reply

    #13617
  38. I don’t seem to be experiencing the same success:

    Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 30720 bytes) in /home/djangmoh/public_html/wp-admin/includes/plugin.php on line 428

    I have gone into my wp-config.php file and putting in
    <?php
    define('WP_MEMORY_LIMIT', '128M');
    at the top.

    No luck, error prevails :( Can't do solution 1 due to access issues, and solution 2 didn't do anything.

    Reply

    #13645
  39. Ok, as a follow-up, I’ve asked the host to increase the memory limit, which they have to 100M. Still, the error persists below.

    Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 30720 bytes) in /home/djangmoh/public_html/wp-admin/includes/plugin.php on line 227

    Reply

    #13646

Leave a Comment

Bloggista Recommends

Sponsors

  • Philippines Web Hosting

Recent Readers