Getting an error that says “Allowed Memory Size Exhausted” 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 WordPress error can be fixed quickly and easily.
In this article, I’ll explain to you all what you need to know about WordPress PHP memory limit so you can fix the allow memory size exhausted error.
Let’s get started!
Table of contents
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.
WordPress generates this error message when it needs more memory than it is allocated.
The PHP memory limit for WordPress is 32MB by default. This works for websites with few pages and a limited amount of content and plugins. However, the more content you add to your website, the closer you get to your maximum memory limit.
The available memory will automatically increase to 40MB when this limit is reached, such as when you upload heavy media such as a movie.
The error message described above will appear if you still exceed the limit and you won’t be able to add new content.
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 or 40M, the solution is to increase the memory allocation to your site.
Let’s see how to do that!
WordPress supports PHP memory limit increases beyond 40MB, but it’s worth pinpointing the cause of memory max-outs before increasing your limit. Your memory issue may be caused by more than simply available space – adding more memory will only be a temporary fix – you’ll continue to see the same error if you don’t fix the cause of it.
Memory limit issues are most often caused by two factors:
If you’ve removed problematic plugins, and cleaned up your content, but you’re still getting memory errors, you might need to increase the memory limit.
This can be accomplished in two ways:
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. If it has not worked, you need to contact your hosting provider support.
If editing the wp-config.php file didn’t work you need to contact your hosting provider and ask them to increase your WordPress PHP memory limit.
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.
We hope this article helped you to increase the PHP memory limit of WordPress to solve the memory exhaustion error.
In this article, I’ll show you how to easily turn off PHP errors in WordPress.
WordPress error logs started guide: All what you should know to set up and access WordPress error logs.
The main cause of pluggable.php errors is the possibility that a new function may not be able to override the default WordPress functions.