Fix: WordPress Memory Exhausted Error – Increase WordPress Memory Limit

Sometime you might have to face an error while activating a new plugin or doing some other stuff. This error might look like:

 The most possible reason for this error is that you have exceeded your default Memory Limit.

Since WordPress 2.5 there is a wp-config.php option WP_MEMORY_LIMIT which allows you to change the maximum amount of memory allocated to your website. If you change this option for your website it will only affect your WordPress website and not other PHP websites on the server.

WordPress allocates 40MB for single websites and 64MB  for multisite installation. But the php.ini allocated memory supersede the wp-config.php value. For example, if php.ini is configured to 64MB and your WordPress allocated 40MB memory, then the website will 64MB not 40 MB memory.

There are number of ways to fix this error. Some are listed below:

From wp-config.php

To change the WordPress memory limit you just add the following into the wp-config.php.

WordPress memory can be different to the server – you need to set this regardless of server memory settings

From php.ini

If you have access to your php.ini file, then you can change the line in php.ini. Search for the property memory_limit and change the value to something greater like 64M

 From .htaccess

If you don’t have the access to php.ini file you can change the memory limit from the .htaccess file. Go to the root folder of your website and create a new .htaccess file if it doesn’t already exist and add the following line to your htaccess file.

 If none of the above methods work, please contact your hosting service provider.