How to Fix "Fatal Error: Memory Exhausted Error" Using cPanel

How to Fix "Fatal Error: Memory Exhausted Error" Using cPanel

Now and then, you may encounter a few common WordPress errors. Memory Exhausted Error is one of them. Are you facing such error?

If so, you can quickly fix this by increasing the default PHP memory limit of the web hosting server. You should know that to maintain a decent environment; every server has its default memory limit.

But a few plugins or the theme may require more memory to work correctly. When your website keeps growing, it may want to use more resources.

In this tutorial, you’re going to learn the way to fix this error using cPanel. Before that, you should know about this error in detail.

What is the Memory Exhausted Error

As you already know, to run a WordPress website, you require a web hosting server. And WordPress is written in PHP language.

It’s a server-side language, so it means when WordPress code needs more memory than the default memory allocated by the web hosting server, it tries to increase the memory automatically.

But it goes only up to 64MB which isn’t enough in many cases.

To increase the memory, you have to add a code to the wp-config.php file which is present in your WordPress directory. To access that, you have to use cPanel provided by your web hosting company.

Follow these Steps to Increase the Default Memory Limit

I hope you’re familiar with the interface of cPanel. If you aren’t, let me tell you that every company has its own design but the options available in the cPanel will be almost similar.

So you have to focus on the content, not the design.

Step 1

Login to the cPanel account and open the File Manager from the Files’ section. It’s one of the most common icons you may use every now and then.

If you’re not a techie person, don’t worry, it’s easy to find.

Step 2

Make sure that you see the root directory/public_html instead of the main directory. You can check it from the left-hand-side navigation menu.

Just click on public_html and you will see the files and folders of your website.

Note: If you have multiple websites hosted on the single server, you may have to find the folder of the website and open it.

Once you do that, you have to search for the wp-config.php file.

Step 3

Don’t get confused between the wp-config.php and wp-config-sample.php files. Now to edit the wp-config.php file, you can either right-click or use the Edit option shown in the main navigation menu.

The choice is yours. But most of the people prefer to use the right-click because it’s convenient.

Step 4

Once you click on the edit link, a popup will appear in front of you. It will show the location of the file and you just need to confirm that you want to edit the file by clicking on the Edit button.

Step 5

The code editor will get opened in a new tab and you can easily see all the codes added by the caching plugin or any other plugins to this file.

Now you have to add one line of the code at the end of this file before a comment “That’s all, stop editing! Happy blogging.”

define( 'WP_MEMORY_LIMIT', '256M' );

That’s it. Click on the Save button from the top-right corner of the page and you’re all set. Try clearing the cache of your browser and check your website.

The memory exhausted error may not be there. If so, congrats, you have successfully fixed the issue.

This code tells the web hosting server to increase the memory limit to 256MB. Sometimes, it doesn’t work. In such cases, the web hosting doesn’t allow the change in the memory.

If so, the only way is to contact your web hosting customer support.

As you know, most of the people use the shared web hostings which have the less number of resources as compared to the cloud hosting or the dedicated servers.

So to fix this error, you may have to ask the customer service representative to increase the memory limit manually.

I Hope Now You Can Easily Solve this Error

Most of the people fret a lot when they see such error. It’s because if the WordPress codes require to use more memory, you may not be able to install or update any plugin or a theme.

You may not be even able to upload any media file. So it can be frustrating. Although you will be able to access the admin area still, it’s of no use

So, it’s better you learn to edit the WordPress files. As you have seen above, cPanel is easy to use.

Many people may consider using FTP, and you can also do that. But cPanel is much more comfortable. I hope you can add the code to increase the memory limit and fix the memory exhausted error.

If you still have any doubt, feel free to drop a comment and contact us through the contact form.

Conclusion

The primary goal is to increase the default memory limit of WordPress. For which, you need to learn where to find the wp-config.php file.

Don’t be afraid to use cPanel; it’s quite easy to navigate. Follow the steps mentioned above, and you will solve the issue within a few minutes.

 

Check out these top 3 cPanel hosting services:

Hostinger
$2.99 /mo
Starting price
Visit Hostinger
Rating based on expert review
  • User Friendly
    4.7
  • Support
    4.7
  • Features
    4.8
  • Reliability
    4.8
  • Pricing
    4.7
HostArmada
$2.49 /mo
Starting price
Visit HostArmada
Rating based on expert review
  • User Friendly
    4.5
  • Support
    4.5
  • Features
    4.5
  • Reliability
    4.5
  • Pricing
    4.0
FastComet
$1.79 /mo
Starting price
Visit FastComet
Rating based on expert review
  • User Friendly
    4.7
  • Support
    5.0
  • Features
    4.8
  • Reliability
    4.5
  • Pricing
    5.0

How to Delete Extra Database Tables After Uninstalling a WordPress Plugin

Not all the plugins come with an option to delete all the settings
4 min read
Max Ostryzhko
Max Ostryzhko
Senior Web Developer, HostAdvice CTO

How to Edit WordPress's wp-config.php File Using cPanel

As I have mentioned earlier, this file is responsible for connecting your websit
3 min read
Eliran Ouzan
Eliran Ouzan
Web Designer & Hosting Expert

How to deactivate all your WordPress plugins at once from cPanel

While handling a WordPress website, you may encounter with many common WordP
4 min read
Max Ostryzhko
Max Ostryzhko
Senior Web Developer, HostAdvice CTO

How to Edit the CSS for your WordPress Site Using the cPanel Hosting Control Panel

As you know, the design of a WordPress website is controlled by
4 min read
Avi Ilinsky
Avi Ilinsky
Hosting Expert
HostAdvice.com provides professional web hosting reviews fully independent of any other entity. Our reviews are unbiased, honest, and apply the same evaluation standards to all those reviewed. While monetary compensation is received from a few of the companies listed on this site, compensation of services and products have no influence on the direction or conclusions of our reviews. Nor does the compensation influence our rankings for certain host companies. This compensation covers account purchasing costs, testing costs and royalties paid to reviewers.
Click to go to the top of the page
Go To Top