Updated: 11 June 2014. Published: 22 October 2009
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.
21 thoughts on “Fix PHP Fatal error: Allowed memory size of 33554432 bytes exhausted”
Thanks men 🙂 it works
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.
Thanks Game Previews and Jas for your commenting…
Thank you. But it only worked after I increased the memory_limit = 64M .
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? 🙁
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.
After a long and constant search I found the file set and it worked for me.
Thanks a lot.
Unfor I cant download the pack.
How exactly do i creat a htaccess file please?
Thanx for the help
Thanks for the comment. I have updated the download link and not you can download it.
The download links still don’t work that are listed on this page.
It is working. I have also emailed you the file
Thanks, the .htaccess option works for me fine!
Thank you, thank you, thank you!!
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!!
Nevermind… I tried the link again, it’s up. This is a life saver, it worked 🙂
Thanks once more.
Thanks for the article.It helped me a lot…
Hi, I tryed with 32, but it works with 64 if your theme need 3.X wordpress version.
thank it works
Nevermind… I tried the link again, it’s up. This is a life saver, it worked
Hi Sakin, I’m getting the same error. Thanks for this post your solution worked in my website too. Many many Thanks!
thanks brother. your tutorial make my dashboard alive again. 🙂
Comments are closed.