post-page

WordPress and the Fatal Memory Error

14
responses
by
 
on
August 29th, 2010
in
WordPress, WordPress Troubleshooting

Remember the old days when your computer would crash because you were running too many applications simultaneously? Well, you might be surprised to know that WordPress can fall victim to the very same thing.

You see, your server may be packed with 4 GB of RAM, but that doesn’t mean that all 4 GB have been allocated to PHP on your account. In fact, most decent hosting providers only allocate 32 MB to PHP under each account. Now, most WordPress installations with a good amount of plugins will run fine under 32 MB, but there’s always a chance that one more plugin or one seemingly innocent admin panel task (like exporting or importing posts) may put you over the edge, and you’ll see either a blank screen or the infamous error which starts off something like “Fatal error: Allowed memory size of 33554432 bytes exhausted.”

If you see a blank screen, refer to WordPress and the White Screen of Death before continuing.

Update: Thanks to Big Dave Zatz for reminding me that if you see this error either suddenly (no specific task was done to cause the error) or frequently, try deactivating all plugins to rule-out a plugin-specific issue and try switching themes to rule-out a theme-specific issue.

If you see the infamous fatal memory error, there are three things that you can do before asking your hosting provider for assistance. Which method you use depends entirely on your server configuration. If one method doesn’t work, try the next. Keep in mind that most hosting providers closely monitor memory overrides and don’t take too kindly to frequent use.

1. If you’re using WordPress 2.9.2 or lower, try adding define('WP_MEMORY_LIMIT', '256M'); to your wp-config.php file. If you’re using WordPress 3.0 or higher, WordPress automatically does this for a variety of tasks, so there’s really no reason to try it in this case.

2. If you can edit or override the system php.ini file, increase the memory limit. For example, memory_limit = 256M

3. If you cannot edit or override the system php.ini file, add php_value memory_limit 256M to your .htaccess file.

If neither of these work, it’s time to ask your hosting provider to temporarily increase PHP’s memory allocation on your account. Keep in mind that most decent hosting providers allocate 32 MB to PHP under each account, and most decent hosting providers allow users to temporarily increase the memory allocation. If your hosting provider won’t accommodate you, perhaps it’s time to find a new hosting provider.

As always, if you need further assistance, the volunteers in the WordPress Support Forums will be more than happy to help you.

heading
heading
14
Responses

 

Comments

  1. Yohan Perera says:

    I had this problem for a long time and had a hard time until my host fixed the problem. As you have said none of the solutions given in this post worked, because they were subject to override by my server’s configuration…

  2. If this occurs out of the blue, there are also other things to check… When I started getting it, I was pretty confused because my Twitter widget in the sidebar had never produced that error before. Turns out, my site had been hacked and there was some malicious code injected into the sidebar. So the memory limitation actually prevented my site/db from being hacked further. So maybe a lower limit is actually reasonable… as protection and to help you weed out poorly programmed plugins.

  3. Thanks for the article; this is a fairly common issue and whilst I knew overriding the php.ini file, I wasn’t aware this was possible to do via the .htaccess file.

    Also you make a good point about switching hosts if they won’t help you out after the other options have been tried. One of my first hosts were a major overseller and in the end I had to move because none of my dynamic sites were working properly.

  4. Doctor Thomas says:

    The fatal memory error in WordPress can be a sheep in wolf’s clothing. Depending on the plug-ins activated at the time one attempts to up-load, up-date or otherwise change their administrative controls, the noted error can be understood as a warning sign of a conflict with installed plug-ins and attempted changes/additions. The problem is not always your host’s low server memory allocation.

    I have experienced the memory error on numerous occasions on numerous sites. Simple deactivation of currently installed plug-ins and then performing the same process that erred out has worked every time. Subsequent re-activation of the plug-ins has been unproblematic. A number of useful plug-ins that otherwise perform wonderfully have triggered the error message. [Naming those plug-ins here would serve no useful purpose; some readers might assume inherent errors in the plug-ins and that would be misleading and uselessly detrimental.]

    Note: The plug-in conflict is by no means the only vehicle to arrive at the error message. This has been my experience only.

  5. Jimmy says:

    Has this problem but dealt with by wordpress? I’ve never experienced it. I regularly get a page that says it cannot connect with the server. Probably should change hosting provider for that one.

    • James Huff says:

      Well, it’s not a problem that WordPress can deal with. More than likely, the problem is caused by either an overzealous plugin or theme, or severe resource restrictions from your hosting provider.

      Either way, it sounds like you have a great hosting provider since you’ve never seen this before, but then again the connection failures make me think otherwise.



Trackbacks/Pingbacks

  1. […] de nuestro sistema. Para intentar reservar más memoria disponible en nuestro sistema la gente de WeblogToolsCollection.com publica un artículo recopilatorio de soluciones al famoso “Fatal error: Allowed memory size of 33554432 bytes exhausted.” […]

  2. […] de nuestro sistema. Para intentar reservar más memoria disponible en nuestro sistema la gente de WeblogToolsCollection.com publica un artículo recopilatorio de soluciones al famoso “Fatal error: Allowed memory size of 33554432 bytes […]

  3. […] Screen of Death. If you’re seeing “Fatal error: Allowed memory size,” consult WordPress and the Fatal Memory Error. If you’re seeing an internal server error or error 500, consult WordPress and the Internal […]

  4. […] WordPress and the Fatal Memory Error […]

Obviously Powered by WordPress. © 2003-2013

css.php