Problem : How to Fix Memory Size Exhausted Error in WordPress
Memory Size Exhausted Error will be displayed if the script uses complete available PHP memory limit. You can fix this issue in a couple of ways that is by increasing the memory limit of your server or by catching which plugin is using PHP memory limit.
In this tutorial, you will learn all the possible ways of fixing Memory Size Exhausted Error in WordPress. You will go through step by step guide of how you can fix this on your WordPress website.
Increasing PHP Memory Limit to Fix Memory Size Exhausted Error
You can increase PHP Memory Limit within WordPress and in cPanel or WHM. You will know all the methods to increase PHP memory limit.
1. Increasing PHP Memory Limit from WordPress
By default, WordPress uses 64MB, if your WordPress requires more than that you need to increase memory limit by adding a simple line of code to wp-config.php file.
Just paste this line of code right after this line ‘That’s all, stop editing! Happy blogging.’
define( 'WP_MEMORY_LIMIT', '256M' );
By adding this line of code, from now onwards WordPress PHP Memory Limit is increased to 256MB.
If you reload your WordPress website your error should disappear now.
Increasing PHP Memory Limit from cPanel
After making the above changes, if the error hasn’t disappeared then your hosting provider is limiting PHP Memory Limit. You can increase it from cPanel if your hosting provider allows it.
- Login to cPanel
- Under “Software” Section, you can find “Select PHP Version”.
- From this page Click on “Switch to PHP Options”.
- On this page you will see list of all the options that you can change within your cPanel account.
- Click on number right after the Memory Limit option, you will see list of all the numbers that you can set. Select a number that you want set PHP Memory Limit to. Then save it.
- After couple of seconds, your changes will be reflected.
Your website will be back as it is before and “Memory Size Exhausted Error” will disappear.
Here is a quick video on how to update PHP Memory limit on Godaddy server.
Increasing PHP Memory Limit from WHM
If you are not able to see the options to update memory limit on your server, then you should have access to WHM. You can access the WHM if you are using VPS or Dedicated Server.
Follow this guide to Update PHP Memory Limit in WHM if you are a server admin.
2. Catching the Plugin to Fix Memory Size Exhausted Error
While installing & activating any plugin are you facing any issues like these below. I already got this issue and found a solution. I’m using dedicated server, so increased PHP memory limit to 512MB. Still, the issue is not resolved. (Allowed Memory Size Exhausted)
Don’t worry about increasing PHP memory_limit on the server. First of all find out, what is causing the issue. It may happen because one or more plugins using a lot of memory. Even if you want to increase, you can follow these below guides.
I thought some plugins are taking too much memory. So I installed performance testing plugins – P3 (Plugin Performance Profiler). Below is the report from the test.
WordPress Memory Exhausted Error – Increase PHP Memory
After getting the result I came to know that the problem is because of Calculated Fields Form plugin. Deactivated that plugin and scanned again, you can find results below.
There is a lot of difference after deactivating that specific plugin. You can find out your issues too using this technique.
After that I am able activate the plugin without any php memory limit issues.
As you can see, even I tried to increase the PHP memory_limit to 512MB. I’m not able to solve the problem. I’m on a dedicated server so that I can easily increase the limit.
If you are on shared hosting or any other type of hosting service, without access to php.ini or not able to increase the limits. Don’t Panic, First find out what’s the problem, then you can resolve it without increasing any limits. Even I’m using dedicated hosting, increasing the limits not helped me.