WordPress is a collection of PHP script files, so it only makes sense to increase the PHP memory limit when the WordPress memory limit is increased.
WordPress comes with a default memory limit of 32MB, but this may not be sufficient when you have a lot of plugins, and a lot of traffic to your blog.
To increase the default WordPress memory add the following line to the wp-config.php file:
Keep in mind the above limit is 64MB, but it can be set at any increment of 8MB. For instance, 32MB, 40MB, 64MB, 128MB.
The wp-config.php is located in the root directory of your WordPress installation. If you are on a shared hosting platform you may need to ask your host to increase the memory limit. On a self hosted platform you can increase the memory as long as it does not exceed the amount of RAM installed on the server.
After increasing the memory limit for WordPress you will need to also increase the PHP memory limit. If your WordPress installation is self hosted, but your have more than one WordPress blog installed, you will need to allocate enough memory to handle all the installations.
On Linux servers the PHP file that requires editing is located at:
In the php.ini file find the following line:
Set the memory limit to match your installation. Since we set the limit for WordPress in the above example to 64MB we will do the same for PHP’s memory limit:
memory_limit = 64M
If I had two blogs using 64MB each I might set PHP higher:
memory_limit = 128M
Having enough memory allocated for your WordPress installation can prevent a lot of out-of-memory issues.
The TPC! Memory Usage plugin can help keep track of your WordPress and PHP memory usage and see their limits at a glance.