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

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.
  • Facebook
  • TwitThis
  • Digg
  • YahooBuzz
  • del.icio.us
  • StumbleUpon
  • Reddit
  • Google Bookmarks
  • Blogjoints
  • Mixx
  • Bloglines
  • Technorati
  • Propeller
  • Furl
  • NewsVine
  • Sphinn
  • YahooMyWeb
  • MisterWong
  • email How to Resolve Fatal Error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 30720 bytes)

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

  1. [...] like to make some justifications why I have to make a post on this one. First, my previous post on How to Resolve WordPress Fatal Error: Allowed Memory Size of 3355444432 bytes exhausted (tried to al… is getting a decent amount of traffic especially when there’s a new WordPress [...]

  2. Hami on June 11, 2010 at 11:54 pm

    my this problem was solved as soon as I found php.ini in root folder and searching for memory_limit and replaced 32MB with 64MB.

  3. Ehud on June 27, 2010 at 8:25 am

    Thank you very much! the proper solution worked perfectly for me! thanks.

  4. lilydustbin on June 30, 2010 at 12:58 am

    number 3 did it. thanks.

  5. Shahrul on July 2, 2010 at 12:22 am

    Thanks, solution 1 worked for me..

  6. jayengbaya on July 6, 2010 at 5:52 pm

    thanks very very much

  7. jerome on July 11, 2010 at 4:38 am

    I tried solution 3 i got this error Fatal error: Call to undefined function get_option() in admin.php on line 22 i will need to pull my backup….my blog is gone!

  8. aubrey on July 17, 2010 at 2:35 pm

    thank you so much!!!! this really helped!

  9. Lau on August 2, 2010 at 2:39 am

    Oh I love you. Thank you!!

  10. Rachel on August 4, 2010 at 2:32 am

    I used Solution 3 – add define(‘WP_MEMORY_LIMIT’, ’64M’); in your WordPress WP-CONFIG.PHP file.

    It worked like a dream. Thanks for the help!

  11. Black God on August 4, 2010 at 12:09 pm

    For me, both Solution 2 & 3 didn’t work out. I don’t have access to Solution 1 (php.ini)… going to contact hosting provider to get it done.

    any way thanks for the wonderful post.

    • Black God on August 4, 2010 at 12:28 pm

      My hosting provider namecheap.com supported live. Having php.ini file in public_html did not solve the problem. I copied it to wp-admin folder, it works. Thanks to bloggista and namecheap.

  12. Devin Walker on August 19, 2010 at 12:46 am

    great help, such a simple fix for such a scary error

  13. vm7 on August 20, 2010 at 6:01 pm

    Thanx!!
    Solution 3 is working for me
    Thank you again

  14. Ronaldo on September 2, 2010 at 7:23 am

    Thank you so much! The solution 3 work here!
    Thanks, thanks! Hugs.

Leave a Reply

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

*

BLOGGISTA ON FACEBOOK

Sponsors

  • Philippines Web Hosting

Recent Readers