Are you facing the memory size exhausted error in WordPress? Don’t worry it is one of the most common website errors, and you can easily fix it by increasing the PHP memory limit in WordPress. In this article, we will be discussing two ways for fixing the WordPress memory limit error. Let’s get started.
The WordPress errors aren’t too challenging to troubleshoot and fix. However, it can be complex for beginners as WordPress just provide few details regarding the issue.
This carries us to one of the most common errors in WordPress the WordPress memory limit error. This error is also called a ‘PHP memory limit error’. Below we have shown how this WordPress error looks.
fatal error: allowed memory size of 67108864 bytes exhausted
The WordPress error is likely to occur while you perform certain activities on site like:
Why Do You Observe WordPress Memory Limit Error?
While you buy a hosting plan for your website, your website is allotted a dedicated amount of resources, the resources include memory that is needed to store files of your site and function seamlessly.
Initially, the memory offered by your hosting provider will be adequate for your website. However, as your website grows and you use complicated plugins and scripts, you may ultimately hit your memory limit. That’s when you will observe PHP memory limit error.
How to Check Your Current PHP Memory Limit
If you are on WordPress version 5.2 or above, you can utilize the site health tool to check your current PHP memory limit on your website. From your WordPress dashboard navigate to the ‘Tools’ → “Site Health” → “Info” and scroll down to the server section. There you can view PHP memory limit set on your server.
If the memory limit is low then you need to increase the amount of memory allotted to your website.
How to Fix the WordPress Memory Limit Error?
Unlike several common WordPress errors, the WordPress memory limit issue is quite easy to troubleshoot.
While you have exhausted the PHP memory limit on your site, mostly there are only two ways to fix the error. Either increase the PHP memory allotted to your site or upgrade your current hosting plan.
Increase the PHP Memory Allotted to Your Site
While your website runs out of memory, the simplest method to resolve WordPress memory limit error is to increase the memory of your site.
It is obvious that you can increase the memory limit depending on your hosting provider and plan. However, we will discuss about this aspect in next section.
To increase the memory limit, you will have to edit the wp-config.php file on your WordPress site. You will need an FTP client like FileZilla to locate and edit his file.
Once you have installed FileZilla and set up the connection with your server, you need to find your site’s ‘root’ folder, which is usually either named after your site’s domain or is called public_html or www. Open that folder and search for a file named wp-config.php
The wp-config.php file stores specific information regarding your website’s database and settings. Hence, you mustn’t modify anything except a particular line of code which we will be looking up next.
In fact, it’s an ideal idea to make a backup of your website prior to making any changes to the file.
Now, as you did the backup, you can open up your wp-config.php file.
Then, search for the following line:
define( 'WP_MEMORY_LIMIT', '256M' );
This code will increase the PHP memory limit to 256MB.
Once the code is pasted, you need to save changes and upload the file back to the server and try to repeat those actions while you first saw this WordPress memory limit error.
You can check if the memory exhausted error is fixed. If the issue persists, then it means you still have the WordPress memory limit error. Try the second method to resolve this issue.
Upgrade Your Site’s Hosting Plan
If the above method isn’t working and still getting the WordPress memory limit error, then the only option you have is to switch your hosting. This may incorporate switching the hosting providers, upgrading to a higher tier, or picking a different kind of plan.
It can be quite irritating to face WordPress memory limit error in WordPress. Hope the methods we discussed above helped you resolve the WordPress memory limit error.