The “allowed memory size exhausted” error is one of the most common issues most WordPress users often encounter, especially when using shared hosting plans.
If you’ve been getting an error that says “Fatal error: Allowed memory size of x bytes exhausted”, that means either your server is limiting the amount of memory used by your website or a plugin is consuming too much server memory.
You can fix this error using two different methods. In this post, we’ll show you how to fix this error within a few minutes and get your website up and running.
What Causes The “Fatal Error Allowed Memory Size Exhausted” Error?
As you may know, WordPress uses PHP code and scripts for most of its functions. PHP is a server-side programming language that requires server resources to execute scripts and actions. This means your WordPress system and all of the plugins that you install on your website consume server memory.
The “allowed memory size exhausted” error occurs when WordPress or one of your plugins is taking up too much server memory. When the server exhausts its allocated memory for your website, it gives you the “allowed memory size exhausted” error.
This usually happens when hosting a high-traffic and big websites using small shared hosting servers, which allocate very little amounts of PHP memory per each hosting plan.
To fix the error, you have to manually increase the default PHP memory limit set for your server.
What Is PHP Memory Limit?
The PHP memory limit is the amount of memory that your server allocates for running PHP code and scripts used by WordPress and plugins. Different web hosting providers set different amounts of memory for each of their hosting plans.
For example, some web hosting providers offer 256MB of memory per hosting account. That’s more than enough to host a WordPress website with regular traffic. The memory exhausted errors only occur when your web host allocated lower amounts of memory for each website.
Method 1: Increase PHP Memory Limit
To increase the PHP memory limit, you need to manually set a new memory limit for your server. This involves editing the wp-config.php file located in the server.
You can use two methods to access the WordPress files in your server. You can either use the File Manager in CPanel or use an FTP client app. For the demonstration, we’ll show you how to do it using the File Manager.
Step 1: Login to your CPanel by typing /cpanel at the end of your domain name (eg: yourwebsite.com/cpanel) use the login details you received from your web host in the welcome email to login to CPanel.
Step 2: Open the File Manager and locate the Public.html folder