Fix: WordPress Memory Exhausted Error – Increase PHP Memory
We have transferred numerous client websites, and sometimes a WordPress Memory Exhausted error shows up when activating a new plugin or doing some other task. Usually the error looks like this:
Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 2348617 bytes) in /home4/xxx/public_html/wp-includes/plugin.php on line xxx
We got an email from a user who was facing the same problem, so we decided to do a writeup on it because this is a common problem. The reason why this error shows up is because you exceed your default Memory Limit. There are numerous solutions for it, but in this article we will share the simplest one out of all.
First open your wp-config.php which is located in the root WordPress directory. Then add the following line inside the main php tag:
define('WP_MEMORY_LIMIT', '64M');
We just increased the memory limit to 64M. If you still get the error after this fix, then please contact your host. Also let us know in the comments.
Comments
15 Responses to “Fix: WordPress Memory Exhausted Error – Increase PHP Memory”Share Your Opinions
Tell us what you're thinking...
and if you want a pic to show with your comment, then get gravatar!
Please make sure that you have read our Comment Policy.











I think that this might fix an issue I’ve been having with my site. I just can’t figure out where the main php table is in the wp-confip.php to place the line.
Thanks!
Awesome trick. Is that same with PHP memory limit?
I think the better way is to put this limit in wp-setting.php file where this memory limit already described as 32M, just changed that value to 64M.
Thank you, wparena. I’ll try this.
Changing the settings in the wp-settings.php file fixed my 2 week, driving me crazy, issue! Thank you very much!!
-Chad
Yes, but editing the core files is not the best way. You would have to change that every time you update WordPress. The way we share in this article, will save you time.
I would much rather not modify core files, if possible. Where would I place the line in the wp-config.php file? I’m not sure where the main php table is.
Thanks for the article and the help!
Place it right after the table prefix
That worked. Thanks!
I would like to try it! Thanks for the trick.
Just remember that if the problem is a memory leak (either in PHP itself or in some library that is used by a plugin), this will merely delay the occurence.
Before you change the memory limits, you should ensure that you’re using the most up-to-date versions of any plugins. Be sure you are running the newest version of WP. If your host offers multiple versions of PHP, be sure you’re using version 5.
Your hosting service may have preset limits on memory usage. If your editing causes you to exceed those limits, your service may be suspended or canceled without warning.
Great article. A brand new plugin that may soon find its way on to this list is Cobalt WP Boost.
Check it out here:
http://frugaltheme.com/about/cobalt-wp-boost-plugin/
It allows blog owners to raise their WordPress Memory Limits with a couple of mouse clicks, as well as showing at-a-glance memory usage information. WordPress keeps its internal memory limit at 32MB, which is fine for a small-time blog; but if you’re trying to add any robust plugins for social networking or ecommerce applications, 32M will not suffice. This problem can only be expected to worsen with the release of 3.0 which, judging from the beta release, will consume a lot more memory itself without upping the 32MB limit.
I just downloaded the plug-in and I’ll give it a try on my test site. Thanks.
I have done the trick but seems like nothing happened. The error keep showing so can you suggest other solutions?
On some hosts, this trick won’t work. So you have to ask (beg) them to increase the PHP Memory Limit. OR get rid of the plugin which is causing it.