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.

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.

wp-serverinfo

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', '512M' );

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 128MB 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.

Did you know that by sharing this article you are helping me? Thanks for your support.
Tom Robak
Tom Robak

Tom Robak is a digital expert with over a decade of experience, specialising in WordPress, SEO, e-commerce, and optimising web performance. His unique skill set, rooted in sales, marketing, and photography, establishes him as a leading creator of customised online solutions.

Grab Your Web Wonders Digest!

Join my newsletter adventure for exclusive WordPress tips, SEO secrets, marketing insights, and some fun stories directly in your inbox!

Leave a Reply

Your email address will not be published. Required fields are marked *

Ready for your new website?

Feel free to book a free consultation, or just drop me an email. I'm excited to chat with you!

Free initial consultation

Write an email