The “allowed memory size exhausted” error is one of the most common factors most WordPress users often encounter, significantly when using shared hosting plans.
If you’ve been getting an error that claims “Fatal error: The allowed memory size of x bytes exhausted”, which suggests each your server is limiting the amount of memory utilized by your website or a plugin is consuming an extreme quantity of server memory.
You can restore this error using two fully completely different methods. In this publish, we’ll current you learn the way to restore this error inside a couple of minutes and get your website up and working.
What Causes The “Fatal Error Allowed Memory Size Exhausted” Error?
As you may know, WordPress makes use of PHP code and scripts for a lot of its functions. PHP is a server-side programming language that requires server property to execute scripts and actions. This means your WordPress system and all of the plugins that you simply arrange on your website eat server memory.
The “allowed memory size exhausted” error occurs when WordPress or one of your plugins is taking on an extreme quantity of server memory. When the server exhausts its allotted memory on your website, it supplies you with the “allowed memory size exhausted” error.
This typically happens when hosting high-traffic and enormous websites using small shared hosting servers, which allocate little or no portions of PHP memory per each hosting plan.
To restore the error, it is necessary to manually enhance the default PHP memory limit set on your server.
What Is PHP Memory Limit?
The PHP memory limit is the amount of memory that your server allocates for working PHP code and scripts utilized by WordPress and plugins. Different web hosting suppliers set fully completely different portions of memory for each of their hosting plans.
For occasion, some web hosting suppliers offer 256MB of memory per hosting account. That’s higher than ample to host a WordPress website with frequent site guests. The memory exhausted errors solely occur when your web host allotted lower portions of memory for each website.
Method 1: Increase PHP Memory Limit
To enhance the PHP memory limit, you need to manually set a new memory limit on your server. This consists of enhancing the wp-config.php file located in the server.
You can use two methods to enter the WordPress recordsdata in your server. You can each use the File Manager in CPanel or use an FTP client app. For the demonstration, we’ll current you learn the way to do it using the File Manager.
Step 1: Log in to your CPanel by typing /cpanel on the end of your space determine (eg: yourwebsite.com/cpanel) use the login particulars you obtained out of your web host in the welcome email to log in to CPanel.
Step 2: Open the File Manager and discover the Public.html folder
Step 3: Find the wp-config.php file then right-click and choose Edit.
Step 4: Search for the street that claims “That’s all, stop editing! Happy blogging” and paste the subsequent code correct above it.
define( ‘WP_MEMORY_LIMIT’, ‘256M’ );
This item has your default PHP memory limit of 256MB.
Step 5: Click Save to avoid wasting heaps of the modifications. Go once more to your website and reload to see if it fixes the error.
Note: Always make a backup copy of the recordsdata sooner than enhancing them.
Method 2: Disable And Reactivate Plugins
Increasing the PHP memory limit typically fixes the memory exhausted error. If not, one of the plugins put in on your website is maybe inflicting the error.
You can check to see which plugin is inflicting the issue by disabling all of the plugins after which reactivating them one after the opposite to hunt out the perpetrator.
Since you probably can’t enter your WordPress dashboard, you need to disable the plugins from the server.
To do this, you need to log in to your server as quickly as soon as extra.
Step 1: Follow the steps in the first method to log in to your server.
Step 2: Open the wp-content folder and discover the plugins folder.
Step 2: Rename the plugins folder to “plugins-bad”. Don’t concern, this acquired delete any of them put in plugins.
Step 2: Create a new empty folder and determine its plugins.
This will disable all of the plugins put in on your website. Now, reload your website and see if it fixes the error. If your website is functioning as common as soon as extra, then the error was probably introduced by a plugin.
Now, return to the wp-content folder. Delete the empty folder that you created earlier and rename the “plugins-bad” folder once more to “plugins”. This will restore your outdated plugins without activating them.
You can now log in to your WordPress dashboard and reactivate the plugins to see which causes the error.
Still, Having The Issue?
If you’re nonetheless getting the equivalent error after following the above choices, then it’s more than likely introduced by a server drawback and you should search for expert help.
Contact your web host’s technical support team and make clear the state of affairs. If you keep getting the equivalent error, take into consideration upgrading your current hosting plan to a higher plan. Or use a managed WordPress hosting account, which includes further optimized features for working WordPress websites.