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.