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.
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.
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
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
Gain access to all tutorials
- Premium tutorials covering WordPress, Laravel and VueJS
- Download premium content
- Download premium WordPress plugins
- Only $5 a month
Join the weekly newsletter
Sign up for our newsletter. You'll be updated on new tutorials as they come available.