Apr
15

How to solve wordpress memory exhausted problem

This trick isn’t guaranteed to prevent all WordPress-generated PHP memory errors, but it certainly seems to help reduce their overall occurrence. For some reason, after my host upgraded their servers to Apache 1.3.41, I began logging an extremely high number of fatal PHPmemory exhausted” errors resulting from the WordPress cache.php script. Here is an example of the countless errors that are generated

1
2
3
4
[17-Feb-2008 19:26:38] PHP Fatal error:  Allowed memory size of 33554432 bytes exhausted (tried to allocate 6233929 bytes) in /home/.../press/wp-includes/cache.php on line 330
[17-Feb-2008 19:30:57] PHP Fatal error:  Allowed memory size of 33554432 bytes exhausted (tried to allocate 6327989 bytes) in /home/.../press/wp-includes/cache.php on line 330
[17-Feb-2008 19:33:35] PHP Fatal error:  Allowed memory size of 33554432 bytes exhausted (tried to allocate 6253909 bytes) in /home/.../press/wp-includes/cache.php on line 330
.

After researching online and learning that I am not alone with this issue, I deployed a threefold defense strategy to eliminate future memory conflicts related to the now-infamous cache.php pandemic. First, open the file wp-includes/cache.php and place the following code immediately after the opening <?php tag:

1
ini_set('memory_limit','32M'); // set memory to prevent fatal errors

After that, create an htaccess file for the wp-includes directory and insert the following directive:

1
2
# set memory limit for cache.php
php_value memory_limit 32M

Finally, create a local php.ini file in the same directory (wp-includes) and insert this:

1
2
;; set memory limit for cache.php
memory_limit = 32M

And that’s it. Save, upload, test and check for additional errors. If necessary, you may wish to try alternate values for the memory limit. I am not positive, but I think that valid values include 8, 12, 16, 32, 64, 128, ...etc., but the upper limit will vary depending on your server settings. Like I said, it doesn’t always work, but it definitely seems to help reduce the overall volume of memory-related errors in certain environments. To facilitate this part of the implementation process, I have zipped a complete set of the three required files in their respective formats. Simply unzip, upload and done.

Note: If you happen to have absolutely any idea(s) as to why this problem continues to occur, there is a growing number of WordPress users (myself included) that are desperate for the answer. As mentioned in the article, increasing/limiting PHP memory (via any method) does not always work. Unfortunately, many users continue to log hundreds of these errors every day. Any clues and/or alternate fixes are more than welcome!





Related posts


Want automatic updates? Subscribe to our RSS feed or
Get Email Updates sent directly to your inbox!
  • Pingback: Tweets that mention How to solve wordpress memory exhausted problem - Go Boxy -- Topsy.com

  • glee

    Terrific stuff from you, man. Ive read your stuff prior to and youre just too awesome. I really like what youve got here, appreciate what youre saying as well as the way you say it. You make it entertaining and you nonetheless manage to keep it smart. I cant wait to read a lot more from you. This is definitely a great blog.

  • torontostar

    I have already bookmark you page

  • Sara Watcerson

    It was certainly interesting for me to read that blog. Thank you for it. I like such themes and everything connected to them. I definitely want to read a bit more on that blog soon.

  • Fiona

    it is a great post thanks for writing it!

  • beatit

    Only want to say your article is as tonishing. The clearness in your post is simply spectacular. Well with your permission allow me to grab your rss feed to keep up to date with succeeding post. Thanks a million and please keep up the ac complished work.

  • idiot

    Perfect write-up! I’m only begining in advertising and attempting to learn to perform it nicely – assets just like this article are extremely precious.

  • Samsung Soul

    Hey – nice blog, just looking around some blogs, seems a pretty nice platform you are using. I’m currently using WordPress for a few of my sites but looking to change one of them over to a platform similar to yours as a trial run. Anything in particular you would recommend about it?

  • http://www.rockandrollhalloffame.net/ Rock and roll hall of fame

    I usually don’t post in Blogs but your blog forced me to, amazing work.. beautiful …

  • http://watch-thegreenhornet-online.com/ watch the green hornet online

    Hi,

    Thanks for sharing the link – but unfortunately it seems to be not working? Does anybody here at http://www.goboxy.com have a mirror or another source?

    Thanks,
    James

  • http://www.jestyle.com Boxy Kid

    I have verified our link, he work perfectly
    I have also sent you an email with the attachement file.

  • http://www.goboxy.com Go Boxy

    my advise, stick with WordPress, but you may try other platform, as a matter of experience.

  • http://www.goboxy.com Go Boxy

    links are working, tested