Complete solution to increase the WordPress Memory Limit

We have all seen it at some point. A common error 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 and of course WordPress memory consumption increases with the amount of modifications. Simply the more plugins you install and keep activated , the more memory power your website needs.

As a first step of solving this, you need to know where you are at. It’s usually the best way to see your hosting memory allowance. Install a free plugin WP-ServerInfo. It adds a new dashboard widget, that also displays the amount of memory allocated.


Once you have determined your initial value, you should do the following to increase the Memory Limit. First of all add these lines to your wp-config.php file.

define( 'WP_MEMORY_LIMIT', '256M' ); 
define( 'WP_MAX_MEMORY_LIMIT', '384M' );

What numbers you put in is up to you. WordPress memory can be different to the server – you need to set this regardless of server memory settings. Me, I like to think big. However do not overdo it and put in 2048MB. Try to stay under 512MB. Then check again via the WP-ServerInfo Widget. All good? Good. If it still says the same value (which has never occurred to me), then try editing you .htaccess file as a last resort, by adding this line to it:

php_value memory_limit 256M

However this will be useless if they are overwritten by the php.ini. You must also edit your php.ini. The php.ini is a file your hosting provider makes available for you. You cannot edit it from your WordPress installation. If you don’t have php.ini file please contact your hosting support. If your hosting doesn’t support memory allowance more than 96MB you need to consider changing hosting provider asap. If you have access to your php.ini file, change the line (if your line shows 64M try 128M):

memory_limit = 128M ; Maximum amount of memory a script may consume (128MB)

Good luck and as always: Backup your files before you attempt any of this.

Czy wiesz, że udostępniając ten artykuł pomagasz mi? Dziękuję za Twoje wsparcie.

Leave a Reply