Fatal Error: Allowed Memory Size Exhausted

It’s very common to get fatal error messages about memory; ‘Fatal Error : Memory Size Exhausted’. This can happen when you install themes, plugins, upgrade to the latest WordPress version or when your theme or plugin perform actions that require more memory than usual. In most cases the best solution is to contact your host and report them you need to increase your PHP maximum size limit, however you can also do it yourself by following these instruction provided by Dailybloging.org

Increase the limit via PHP.ini file

You can directly increase the PHP Memory Limit if you’ve access to the PHP.ini file. Most small Shared hosting servers won’t give you access to the PHP.ini file. But some servers allow you to create a duplicate PHP.ini in your respective site Directories whose data/values will override the default PHP.ini values. To do that you just need to create a file with the name ‘php.ini’ in the directory where your WordPress site is installed. In that just add the command memory_limit = 64M in it to increase the Memory Limit to 64 MB.

Changing the Memory Limit via wp-config.php

If you don’t want to mess with the PHP.ini file, then you can go for this method. In this you won’t be needing to create any extra file in your Directory. Just Adding define(‘WP_MEMORY_LIMIT’, ’128M’); in your ‘wp-config.php’ file would increase your PHP Memory Limit to 128 MB.

Modifying the .htaccess file to Increase Memory Limit

A Default WordPress Installation won’t have a .htaccess file. But in case you already have it for some purposes like ‘301 Redirection’, just add the command php_value memory_limit 128M in your ‘.htaccess’ file and your memory limit will increase to 128 MB.

Changing the Memory Limit via install.php

This method is just an Alternate to the php.ini method. Because the function of the code we use in this method is same as what we put in the php.ini file.You just need to place the code ini_set(‘memory_limit’,’32M’); in the ‘install.php’ file which is placed in the wp-admin folder of your WordPress installation.