Paulund
2012-10-10 #wordpress

Increase WordPress Memory Limit

A common error you can come across in Wordpress is a PHP memory limit error. This happens when Wordpress doesn't have enough memory to achieve what you want. It can be caused by poorly written plugins that will continue to run a procedure until the installation runs out of memory. Since version 2.5 there is a wp-config.php option WP_MEMORY_LIMIT which allows you to configure the maximum amount of memory that can be used by PHP. When you change this option in the wp-config.php it will only affect your Wordpress site and not any other PHP sites. The default memory allocated to Wordpress is 40MB for single site installs and 64MB for multisite installs. If the value in the php.ini is more than the allocated Wordpress amount Wordpress will use this value. For example if Wordpress has allocated 40MB of memory and php.ini is configured to 64MB then Wordpress will use 64MB. To change the Wordpress memory limit you just add the following into the wp-config.php.


define('WP_MEMORY_LIMIT', '64M');

If this doesn't change your allocated memory limit your hosts may not allow you change this setting, if this is the case you should contact your hosting company. ## With PHP.ini

You can change the memory limit of your website in the PHP.ini file, with some web hosts you might not have access to change the PHP.ini file for your website. But if you do search for the property memory_limit and change the value to something greater like 64M.


memory_limit = 64M

With htaccess

You can even change the memory limit of PHP from your sites 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.


php_value memory_limit 64M