Monthly Archives: July 2011

Allocating More Memory To WordPress

I often get the problem with WordPress plugins that there is not enough memory available to execute them correctly. It’s quite simple to fix this, the default is usually 32 MB, there are several things you can try:

1. Add the following line to your wp-config.php file:
define('WP_MEMORY_LIMIT', '64M');

2. If you have access to your PHP.ini file, change the line in PHP.ini where the memory limit is set. Change the 32M to 64M:
memory_limit = 64M ; Maximum amount of memory a script may consume (64MB)

3. If you don’t have access to PHP.ini you can try adding this to an .htaccess file:
php_value memory_limit 64M

4. There’s another one that is worth trying, I added this line to my wp-includes/cache.php file:
ini_set('memory_limit','64M'); // set memory to prevent fatal errors

There is more on changing the memory allocation via wp-config.php and more at WordPress Codex.