How to Resolve the WordPress Memory Limit Error

What are the options for resolving an exhausted memory size problem in WordPress?

Initially, you may find this confusing, since you won’t know what caused the problem or how it can be fixed.

The good news is that this is one of the simplest issues to resolve, and anyone can do this, no matter how new they are to WordPress.

There is a simple workaround for this WordPress error that involves increasing WordPress’ PHP memory limit

Fatal error: allowed memory size example

The purpose of this article is to demonstrate how to fix WordPress memory exhausted error by increasing PHP memory.

What is WordPress Memory Exhausted Error?

The WordPress platform is written in PHP, which is a server-side language. A web server is just like any other computer.

To run multiple applications simultaneously, they need memory. PHP, like other applications, is allocated a specific amount of memory by the server administrator.

The error appears whenever you use more memory than the default memory allocation.

When we speak of PHP memory limits, we mean the amount of server memory that PHP is allocated in order to run scripts. It is recommended to set that number no lower than 64MB. This being said it’s enough in most cases to have 64 MB of RAM.

Adding more PHP memory shouldn’t negatively impact website performance since most hosting servers offer you far more memory than that. As a matter of fact, unless you use a cheap web hosting service, you shouldn’t be worried about your PHP memory limit.

How to Check Your Current PHP Memory Limit

WordPress PHP memory limit

If you access your WordPress dashboard and navigate to Tools > Site Health > Info, you can quickly determine what your PHP memory limit is.

If the memory is low, say 32M, the solution is to increase the memory allocation to your site. Let’s see how to do that!

Increasing The Memory Limit in WordPress

Changing the WordPress memory limit requires editing the wp-config.php file. The file can be downloaded from the public_html folder of your site, download it and open it with your HTML editor.

When editing the wp-config.php file, identify this line.

‘That’s all, stop editing! Happy blogging.’ 

Add the following code just above:

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

With this code, WordPress is told it can use 256MB of PHP memory instead of the default 64MB. After you add this code and save/upload the wp-config file back.

You can instantly check the WordPress site again and the memory exhausted error should have disappeared.

Final Thoughts about the PHP memory limite in WordPress (and final step if the error remains)

It is possible that WordPress is unable to increase PHP memory limits due to your web hosting provider.

Then, the PHP memory limit needs to be increased manually by your hosting company, so reach out their support.

I hope this article helped you to increase PHP memory limit to solve the WordPress memory exhaustion error.

You might also like to read my article on How to turning off PHP errors in WordPress.

The Author

About The Author

This post was written by the WP Umbrella's Team. Managing multiple websites has never been so easy!