‘Fatal Error : Memory Size Exhausted’
Have you come across this error anytime? Such an error occurs when you install a new theme, plugin or upgrade your WordPress to the latest version.
This is because the PHP Memory Limit of your Host is lesser than the process actually needs. In such cases, you might want to increase the host memory Limit in order to complete the process.
Following are 5 different ways you can increase your Host’s PHP Memory Limit:
1. Changing the Memory Limit via wp-config.php:
This method will be comfortable for those who do not want to mess with the PHP.ini file. All you need to do is add define(‘WP_MEMORY_LIMIT’,’XM’); in your wp-config.php file. Here too, ‘X’ is the number of MBs you wish to extend your limit to.
2. Increasing Memory Limit via PHP.ini file:
Most of the small shared hosting servers don’t allow users to access their PHP.ini file. If you are granted access, you can directly increase the memory limit here. If not, you can ask the host to allow you to create a duplicate PHP.ini file in your directory. The data or values in this duplicate PHP.ini file will override the data in the original file. To do this, you can simply create a file named PHP.ini in the directory where your WordPress website is installed. If you wish to increase the limit to X MB, you can enter the command memory_limit = X M; where X is a number.
memory_limit = 256 M;
3. Changing Memory Limit via wp-config.php:
This is an alternative method to the PHP.ini file method. You simply need to add the command: ini_set(‘memory_limit’,’XM’); in your wp-config.php file that is placed in the root folder of your WordPress installation. Note: X is the number of MBs you wish to increase the memory limit to.
4. Modifying the .htaccess file:
In case you have a .htaccess file, you can simply add the command: php_value memory_limit XM in it, to increase the memory limit to X MB. Note: A default WordPress Installation won’t have a .htaccess file.
php_value memory_limit 256M
5. Contact your host:
If you are a non techie or are new to all of this, it is better to get it done from someone who knows it all. Your host can be the best one to get in touch. Contact him to help you increase your PHP Memory Limit.