Fatal error: Allowed memory size of 33554432 bytes exhausted

We were having trouble with a site's memory limits. We had a dozen or so plugins running, but nothing out of the ordinary, and we kept hitting memory limits. Even on the WordPress Dashboard, the Incoming Links and the RSS Feed had the same "Allowed memory size of xxxxxx bytes exhausted." Even more important, we couldn't install new plugins or upgrade WordPress. I've been around the block trying to increase memory for the NextGen gallery, but this was just everywhere.

Here's a quick link to the solution.

I did the usual fixes, as far as you can do on shared or reseller hosting. I even found a really cool plugin called TPC! Memory Usage that showed me what the PHP memory usage was on the server. Pretty graph that went from green to yellow to red as I added more plugins. I deactivated all plugins and then activated them one by one. Pretty soon I was at 96% of resources. The technical sysadmin in me said, "Hmm, that seems like a lot."

wp-config.php

Add this code to your wp-config.php file:

CODE:
  1. define('WP_MEMORY_LIMIT', '64M');

That didn't help.

php.ini

Another solution suggests adding the following code to your php.ini file in your root directory (usually public_html or where WordPress files are):

CODE:
  1. memory_limit = 64M

No dice.

install.php

Yet another suggestion says to edit the install.php file WordPress' /wp-admin/ directory:

CODE:
  1. ini_set('memory_limit','32M');

Ay dios mio!

wp-settings.php

Might as well try this one.

Change "define('WP_MEMORY_LIMIT', '32M');" to "define('WP_MEMORY_LIMIT', '64M');"

.htaccess

While we're at it, we could try the old .htaccess file.

CODE:
  1. php_value memory_limit 64M

As you can guess, we were getting nowhere. These all seemed like bandaid solutions to me. We were trying to "trick" the server into using, or allocating, more memory than it was supposed to. I'm no sysadmin, but it seemed like we weren't getting at the root of the matter. Or as Steve Martin said, "Hey, maybe it's the needle."

The Solution: Switch Hosts

 

The site was on a host that I've been using for years. It's always been just fine. But recently I've set up a reseller account at HostGator and I've noticed speed improvements, better uptime, and it just seems zippier. So I moved the site from one host to the other.

Hmm. This is what I saw using the TPC! Memory Usage plugin. We went from 96% to 7% memory being used. Notice that the Incoming Links box is working again as well as the RSS Feed. OK, so the simple assumption is that we get more memory allocated at HostGator, right? But if each site gets more memory, won't the server crash under the strain? Well, this is where my techno knowledge ends.

Is the site now faster. Yep. Are we using less memory of the total memory. Yes. Can we see the widgets on the Dashboard. Yep. Install plugins. Uhuh. Upgrade WordPress. Affirmative. Yowza.

We love you HostGator!

email

About Bradley Charbonneau

I've done the big corporate thing. I've done the creative writer thing. Now I'm happily in the middle. I like to help small businesses who are interested in "working their website before their website works them." I'm also interested in creating beautiful sites with powerful WordPress themes.

Want More?

Want to get the latest on WordPress design, development, and deliciousness? Sorry, needed a "d" word. Enter your email and you'll be updated with news as it happens.

, ,

2 Responses to Fatal error: Allowed memory size of 33554432 bytes exhausted

  1. website laten maken December 15, 2010 at 2:11 am #

    I know from personal experience that this error can be a real time sucker. Glad to see you have dealt with this problem.

    I think the first couple problems failed because you tried to set the config for wordpress to higher memory limit, but if your host set the memory_limit for your account lets say max 16MB (alot of shared server hosting only has 16MB max memory!) u can't get more memory. And only your host can set the memory_limit property for you, thats why I moved to a VPS server where I can change the settings myself :)

    Properly HostGator has a memory_limit of 128MB, which is great for shared hosting!

  2. Bradley Charbonneau December 15, 2010 at 3:21 pm #

    Thanks for the note about trying to "force" more memory whereas if the host sets it at a certain level, it won't matter what you put in, the max is what the host sets as the max.

Leave a Reply

CommentLuv badge