How to Resolve Fatal Error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 30720 bytes)
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:
memory_limit = 12M
… 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):
ini_set('memory_limit','32M');
The updated /install.php file should look like this:
ini_set('memory_limit','32M');
/**
* WordPress Installer
* @since unknown
* @var bool
*/
define('WP_INSTALLING', true);
Solution 3. Add this line of code in your WordPress WP-CONFIG.PHP file. Add it before any other values. (My preferred choice)
define('WP_MEMORY_LIMIT', '64M');
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.






























































[...] 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.
great help, such a simple fix for such a scary error
Thanx!!
Solution 3 is working for me
Thank you again
Thank you so much! The solution 3 work here!
Thanks, thanks! Hugs.