Site Overlay

Fix PHP Fatal error: Allowed memory size of 33554432 bytes exhausted

Updated: 11 June 2014. Published: 22 October 2009

Fix PHP Fatal Error
Fix PHP Fatal Error

I just upgraded my WordPress and then I got PHP Fatal Error problem. Also when I tried to upgrade the plugin, the error keeps on coming which prevent me from upgrading the plugins.

Example of the Error:
PHP Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 6233929 bytes) in /public_html/…/wp-includes/cache.php on line 330

To fix this PHP Fatal Error problem in WordPress, you can use following tricks.

Increasing memory allocated to PHP

Many times you will get this error due memory size allocated for PHP less then needed. Please note, this setting may not work if your host does not allow for increasing the PHP memory limit–in that event, contact your host to increase the PHP memory limit.
Increase PHP Memory using wp-config.php file
Use your FTP access or hosting access and then find wp-config.php file in your WordPress installation root directory and then add the following code in your wp-config.php file. If 64M doesn’t work then you can further increase to 96M or more.

define( 'WP_MEMORY_LIMIT', '64M' );

Increase PHP Memory using php.ini file
Use your FTP access or hosting access and then find php.ini file and then edit the memory_limit. If 64M doesn’t work then you can further increase to 96M or more.

memory_limit = 64M;

Increase PHP Memory using .htaccess file
Use your FTP access or hosting access and then find .htaccess file in your WordPress installation root directory and the add the following code. If 64M doesn’t work then you can further increase to 96M or more.

php_value memory_limit 64M

If the above option doesn’t work then try the following steps

Step 1: Open the file wp-includes/cache.php and add the following code immediately after the opening <?php

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

Step 2: create an htaccess file for the wp-includes directory and add the following code:

# set memory limit for cache.php
php_value memory_limit 64M

Step 3: Create php.ini file, add the following code and upload in the same directory (wp-includes):

;; set memory limit for cache.php
memory_limit = 64M

If necessary, you may try increasing the values for the memory limit.

If you have problem with editing these files then you can download the complete set I have customized for my site.
Click here to download.

Published By:

Author: sakinshrestha

Hello. My name is Sakin Shrestha, and I am a technology entrepreneur from Nepal. I am passionate about helping this sector grow, for many reasons. The technology sector creates jobs for many young Nepalis who would otherwise migrate to foreign countries. It lets Nepali professionals develop skills for a fast-changing global workplace, and compete at a high level with anyone, anywhere in the world. If it grows, it will provide a viable career option for many young Nepalis, and help us reap the benefits of a global economy.

21 thoughts on “Fix PHP Fatal error: Allowed memory size of 33554432 bytes exhausted

  1. It worked in my website too. But I had similar error and it is fixed. This error happened when I tried to import the posts from my another blog. Here goes my error Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 7680 bytes) in /wp-includes/kses.php(413) : runtime-created function on line 1. Thanks Sakin, you saved me.

  2. Hmmm… I’m getting the same error, but even 64M isn’t working. I have no other plugins installed (Akismet is currently disabled). Apparently your hosting company can lock you down and not allow this fix? 🙁

  3. Hi Stephanie,

    You can increase the size to 125M. Make sure that you have made changes to all three files.

    Click Here to download the Pack with 125M.

    If this doesn’t solve your problem then can you email me what you get as an error message.

    Regards,
    sakin

  4. After a long and constant search I found the file set and it worked for me.
    Thanks a lot.
    🙂
    —Imran

  5. Hi, I guess your solution seems to be working for a few people, have the same problem but I can’t download the pack. Any chance I can get it by e-mail. That would be very appreciated.

    Thanks a bunch!!

Comments are closed.