(How to solve) Fatal error: Allowed memory size exhausted

James Ryan Jonas

I tried to automatically upgrade our blog today using the Upgrade link in the WordPress Dashboard, but it failed because of an error:

Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate … in /wp-includes/http.php on line 1358

The “fatal error” might be a bit scary to see, but don’t worry because the solution is going to be easy.

Bytes exhausted?

Wordpress PHP Fatal Error: Allowed memory size exhausted tried to allocate bytes

The bytes figure may be different in the error you have: “8388608 bytes exhausted” (8 MB); “16777216 bytes exhausted” (16 MB); “33554432 bytes exhausted” (32 MB); to “67108864 bytes exhausted” (64 MB). All these figures simply represent the allowed php memory on your host’s server.

Which means the solution is to adjust this to a higher number. So if your current allowed php memory is 8 MB, double it to 16 MB. You can increase it to an even higher number but be wary because further increasing the php memory size could also cause performance issues on your blog. The default rule is to simply double the current allowed php memory size.

How to solve on a WordPress blog?

1. First, download a copy of your wp-config.php file from your server. Make sure you create a back-up copy which you can revert to just in case some problem crops up.

2. Open wp-config.php file and, on the second line, just right below the very first <?php line, add the following:

ini_set(“memory_limit”,”64M”);

Again, you can change this 64M number to a number you want, but better to simply double the allowed php memory you currently have.

3. Save the file then upload back to your host. Things should go on smoothly from now on.

It worked for me, so it would most probably work for you too. Hope this tip helps.

James Ryan Jonas teaches business management, investments, and entrepreneurship at the University of the Philippines (UP). He is also the Executive Director of UP Provident Fund Inc., managing and investing P3.2 Billion ($56.4 Million) worth of retirement funds on behalf of thousands of UP employees.