How to Solve the “WordPress Memory Limit Exhausted” Error: A Comprehensive Guide to WP Memory Limits
Getting the “Allowed Memory Size Exhausted” error in WordPress?
This comprehensive guide is aimed at teaching you everything there is to know about WordPress PHP memory limits, including how to permanently fix that “allow memory size exhausted” error.
Let’s get started!
Understanding WordPress Memory Limit Exhausted Errors
WordPress is written in PHP, relies on server-side memory to function. Just like a regular computer, web servers need memory to run multiple applications simultaneously. PHP is allocated a specific amount of memory to function, set by your hosting provider.
The WordPress Memory Limit Exhausted Error occurs when WordPress needs more memory than it’s been allocated. These errors are more likely to happen on shared servers.
In the realm of page builders and no-code tools, it’s easy to overlook foundational mathematical principles applied to computers. The ‘memory limit exhausted’ error serves as a reminder that these underlying calculations still govern the functionality and limitations of the software nowadays.
What is The PHP Memory Limit In WordPress?
Default PHP Memory Limit
Did You Know?: The default PHP memory limit in WordPress is 32MB, which is usually fine for smaller sites, but will not work as soon as you add more content to your website.
The available memory will automatically increase to 40MB when this limit is reached, such as when you upload heavy media such as a movie.
If you still surpass this limit, you’ll see the “Allowed Memory Size Exhausted” error and won’t be able to add any new content, or hide this php error.
How to Check Your Current WordPress PHP Memory Limit
To determine your current PHP memory limit, head over to your WordPress dashboard. Navigate to Tools > Site Health > Info. You’ll find what you’re looking for here:
If it reads 32M or 40M, you’re about to expire the error and should consider increasing your memory allocation as soon as possible.
If you’re troubleshooting multiple aspects of your site, you might also be interested in WordPress Error Logs Starter Guide.
What Causes the WordPress Memory Limit Exhausted Error?
Before blindly increasing your PHP memory limit in WordPress, it’s essential to identify what’s causing the issue.
Your memory issues 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:
- Poorly Coded Plugins: Using multiple plugins, especially resource-hungry ones like backup plugins, can rapidly deplete memory and cause this error. Plugins like Updraft usually leave heavy backup archives on your website and should be avoided.
- Heavy Media: Your PHP memory is directly affected by the media you upload. Consistent uploads of videos and high solution images can strain your server resources. Which is one of the reason why you should always compress your media in WordPress.
Ready to boost your productivity, impress your clients and grow your WordPress agency?
Install WP Umbrella on your websites in a minute and discover a new way to manage multiple WordPress sites.
Get Started for freeHow to Increase the PHP Memory Limit in WordPress
Expert Tip
Want a seamless WordPress experience without any PHP memory error? Run awaty from shared hosting and take a dedicated or managed hosting plan that allows for easy PHP memory limit adjustments.
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 simple ways:
Method 1: Editing the wp-config.php File
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.
- Download the
wp-config.php
file from thepublic_html
folder of your site. - Open it with an HTML editor.
- Look for the the line that reads, ‘That’s all, stop editing! Happy blogging.’
- Add the following code just above it:
define( 'WP_MEMORY_LIMIT', '256M' );
This tells WordPress that it can use up to 256MB of PHP memory instead of the default limit. Save and upload the file back to your server.
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.
Mathod 2: Contacting Your Hosting Provider
If editing the wp-config.php
file didn’t fix the issue, you will need to contact your hosting provider to request a WP memory limit increase.
When you’re on a shared hosting plan, the server’s resources (bandwidth and memory) are shared among multiple users. Boosting the PHP memory limit for one site could deprive other sites of resources they need.
So, hosting providers often place caps to ensure fair distribution and/or increase their profitability, and your only option is available is to contact them.
Final Thoughts
We hope this article helped you to understand how the memory limit is managed in WordPress and that you were able to fix your issue.
If you still find yourself hitting a wall even after attempting to adjust the PHP memory limit in WordPress, your only option might be to either upgrade your hosting plan or switch to a hosting provider that offers more flexibility.
For more information on hosting-related issues, read How to Fix The 502 Bad Gateway Error in WordPress.