I am sure you must have noticed a ‘Fatal Error : Memory Size Exhausted’ error when you install a lot of plugins, upgrade to the latest WordPress version or even sometime you’ll find an error in your Dashboard widget which prevents them from loading completely. It’s a very common memory size error in WordPress and it happens when WordPress doesn’t have enough memory to achieve what you want. Such types of errors arise because the PHP memory limit is less than what the process requires for performing its functions.
Many web hosts set the default PHP memory limit to 32MB or less on shared hosting environment and it’s pretty less than the basic requirement for proper functioning a WordPress website. The default memory allocation to WordPress is 40MB for single site WordPress installs and 64MB for installs. If the value in the php.ini is more than the default allocated WordPress amount, then WordPress will use that value. But sometimes your WordPress website requires more memory to run some PHP process and for that you will have to increase the PHP memory limit.
There are number of ways to increase the PHP memory limit on a web server, so you can choose a method best suited for you.
With wp-config.php
You can change the PHP memory limit of your WordPress website from wp-config.php file. Paste this code snippet in wp-config.php to increase the PHP memory limit to 64MB. When you change this option in the wp-config.php it will only affect your WordPress current site and not any other PHP sites.
// increase the php memory limit in wordpress
define( 'WP_MEMORY_LIMIT', '64M' );
With htaccess
You can even change the memory limit of PHP from your sites .htaccess file also. Paste this following line to your htaccess file.
# increase the php memory limit in wordpress
php_value memory_limit 64M
With PHP.ini
If you have access to php.ini file then you can change the memory limit of your website by changing the value of property memory_limit.
# increase the php memory limit in wordpress
memory_limit = 64M