Recently, when either adding new plugins or upgrading plugins in WordPress, I encountered this error message:
Fatal Error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 30720 bytes)…
This means that WordPress needs more memory to run a process than the default PHP setting (usually 12M, in some, 32M). For a non-techie guy like me, the error is frustrating, and very alarming.
Before you panic, there are actually simple solutions to this problem that even a non-techie person can do. The first solution is the “standard” or proper way to resolve it, however, it depends whether you have access to the file that needs to be updated. The second one is much easier, a “hack” to a specific WordPress file, however, you may need to do it again everytime you perform a WordPress upgrade.
Solution 1: Modify your php.ini file
The PHP.INI file can be found in your root directory, usually in /public_html/ directory. That is if your hosting provided you an access to it. In my case, I am using Bluehost/Hostmonster, and it provides you the ability to copy the PHP.INI to your /public_html/ directory then you can make the necessary modifications. Open PHP.INI file and -
Find:
[sourcecode language="html"]
memory_limit = 12M
[/sourcecode]
… change to 32M or higher
Before the new settings could take effect, it “maybe” necessary to restart your webserver.
Solution 2: Add code to your WordPress /wp-admin/install.php file.
Using your hosting file manager or FTP tool, open your /wp-admin/install.php file and add the following code directly under the <?php tag (usually at the top of the file):
[sourcecode language="html"]
ini_set(‘memory_limit’,’32M’);
[/sourcecode]
The updated /install.php file should look like this:
[sourcecode language="html"]
ini_set(‘memory_limit’,’32M’);
/**
* WordPress Installer
* @since unknown
* @var bool
*/
define(‘WP_INSTALLING’, true);
[/sourcecode]
Solution 3. Add this line of code in your WordPress WP-CONFIG.PHP file. Add it before any other values. (My preferred choice)
[sourcecode language="html"]
define(‘WP_MEMORY_LIMIT’, ’64M’);
[/sourcecode]
Try to increase it to 64M if 32M seems to be insufficient. These solutions can also be applied to other PHP-based programs and not just WordPress.
Did you find this useful? If you think there is a need to modify some of the codes or information on this article to make it more meaningful and helpful, feel free to leave your comment and corrections/updates will be made accordingly.
It will be greatly appreciated.
Tags: how to resolve memory fatal error, how to resolve wordpress fatal error, memory exhausted, memory size 33554432, trie to allocate 30720 bytes, wordpress memory problem, wordpress tutorial
[...] like to make some justifications why I have to make a post on this one. First, my previous post on How to Resolve WordPress Fatal Error: Allowed Memory Size of 3355444432 bytes exhausted (tried to al… is getting a decent amount of traffic especially when there’s a new WordPress [...]
my this problem was solved as soon as I found php.ini in root folder and searching for memory_limit and replaced 32MB with 64MB.
Thank you very much! the proper solution worked perfectly for me! thanks.
number 3 did it. thanks.
Thanks, solution 1 worked for me..
thanks very very much
I tried solution 3 i got this error Fatal error: Call to undefined function get_option() in admin.php on line 22 i will need to pull my backup….my blog is gone!
thank you so much!!!! this really helped!
Oh I love you. Thank you!!
I used Solution 3 – add define(‘WP_MEMORY_LIMIT’, ’64M’); in your WordPress WP-CONFIG.PHP file.
It worked like a dream. Thanks for the help!
For me, both Solution 2 & 3 didn’t work out. I don’t have access to Solution 1 (php.ini)… going to contact hosting provider to get it done.
any way thanks for the wonderful post.
My hosting provider namecheap.com supported live. Having php.ini file in public_html did not solve the problem. I copied it to wp-admin folder, it works. Thanks to bloggista and namecheap.
Whew, Black God, Namecheap and Bloggista saves the day. Threw that php.ini file into my wp-admin folder and no more Fatal Errors.
Namecheap told me to create a file with notepad… putting only this: [PHP] memory_limit = 64M in the file and save it as php.ini and upload it to wp-admin folder. That was it.
great help, such a simple fix for such a scary error
Thanx!!
Solution 3 is working for me
Thank you again
Cheers!
Thank you so much! The solution 3 work here!
Thanks, thanks! Hugs.
Cheers!
Thank you so much! Once I added define(‘WP_MEMORY_LIMIT’, ’64M’); to the wp-config Boom it worked. Thanks again.
It feels sooo good to hear it works. Glad to be of help. Cheers!
just add this to your .htaccess
php_value memory_limit 64M
fixed.
I have installed a nice template called lifeline from the themeforest. I have a servage hosting with no access to php ini and i tried both the 2nd and 3rd solution to find that they didn’t work for me.
The solution with the .htaccess proposed here worked as a charm. Thanks reese and ofcourse thanks bloggista. Cheers.
Thanks man for this solution. It’s works on me.
Thanks for the fix! As a ‘non-techie’, I was stuck and very worried when I saw this, but I used solution 3 with my GoDaddy File Manager, and it worked perfectly. Took me about 2 mins from when I initially Google’d the error! Thanks again…
Good ol’ Google led me right to you. One quick non hack and no more errors. You just made my night!
Nice info bro. You are now immersing yourself with wp tech stuff huh?!
tha x a lot brother
Thanks a lot it helped me alot..
I am wordpress newbie but long time Blogger user, never had fatal error before, Whoa!
Number 3 fixed both that and now my blog is also much faster loading also.
So many many thanks. Paul
That really work Method #3 is very easy I had 2 plugins eating the memory as they works in parallel
Thanks
Thanks a ton. Solution 3 worked perfectly for me.
Thanks a lot Bloggista, this really helped me today. I thought I had lost my site. Awesome!
Wow… thanks for the great tips!
I use Solution 3 and works like magic!
Thanks! This solve a long standing issue I have had.
It took me three days I’m going crazy! Only the restart worked for me and that’s thanks to you. Good work!
Just like the others, so thankful I found this solution to my problem! I opted to more permanent solution, since I have access to my php.ini file. Also, I have several wp install in my hosting account i don’t plan to update my wp-config of each site.
Cheers to you Bloggista.
Thanks alot it helped me alot…… great article…. Solution 3 Worked!
thanks man the TDO mini form plugin is working ok now
.
Thank you very much for your help… the solution 3 worked perfectly! THANKS
[...] Error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 30720 bytes),参考了这个帖子,在WP-CONFIG.PHP中最前面加上 define(‘WP_MEMORY_LIMIT’, ’64M’); [...]
Thanks man. I tried Method #3and it works perfectly for me.Thank You So Much.
Learn how to make amazing website with wordpress…
[...]How to Resolve Fatal Error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 30720 bytes) « Bloggista.com[...]…
Aw, this was an exceptionally good post. Spending some time and actual effort to make a really good article
[...] How to Resolve Fatal Error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 30720… * @var bool */ * @since unknown define(‘WP_INSTALLING’, true); * WordPress Installer Solution 3. [...]
Thanks man,
My Problem Was Resolve.