Categories: Troubleshooting

How to Fix the “Allowed Memory Size Exhausted” Error in WordPress (2 Methods)

Maintaining a successful website requires a lot of time and effort. However, unexpected messages such as “Fatal error: Allowed memory size exhausted” can halt your progress. The WordPress memory exhausted error can be particularly frustrating, as it prevents you from accessing your site.

Fortunately, there are a couple of quick fixes for this error. Moreover, you can resolve this issue by yourself without any technical assistance.

In this post, we’ll take a closer look at the “allowed memory size exhausted” error and what causes it. We’ll then show you two easy ways to fix it. Let’s get started!

What the “Allowed Memory Size Exhausted” Error Is (And What Causes It)

WordPress is an open-source Content Management System (CMS). It is written in PHP, a server-side programming language. As such, your WordPress files and plugins use server resources to execute actions on your site.

When you purchase hosting for your WordPress website, your plan typically includes a PHP memory limit. This is the amount of memory that your server allocates for processing PHP code and scripts. Every plugin that you install on your site uses some of this allocation to run. 

This memory amount varies depending on the hosting package you’ve purchased. Beginner-friendly plans tend to provide smaller amounts of PHP memory than advanced alternatives. 

You can check your PHP memory limit in your hosting account. Alternatively, you can view it in your WordPress dashboard by navigating to Tools > Site Health > Info and clicking on Server to view more details: 

The “allowed memory size exhausted” error message comes up when you’ve reached your PHP memory limit. It usually happens when a particular plugin on your site is taking up a large amount of memory. 

Therefore, your WordPress site will require more memory than the currently allocated amount to continue functioning correctly. As such, you will need to reduce the load or increase the memory limit.

How to Fix the “Allowed Memory Size Exhausted” Error in WordPress (2 Methods)

While the WordPress memory exhausted error can be a bit frustrating, you should be able to solve this problem and get back to working on your site in no time. This tutorial will show you how to fix the “allowed memory size exhausted” error using two easy methods.

1. Disable and Reactivate Your Plugins

As we mentioned earlier, a plugin could be using a large amount of your PHP memory. Therefore, you may want to remove this add-on from your site and replace it with a more lightweight alternative.

First, you’ll need to identify the culprit. To do this, you’ll need to deactivate your plugins, then reactivate them one at a time until you find the one that’s causing you trouble.

Since the “allowed memory size exhausted” error prevents you from accessing your WordPress dashboard, you’ll need to connect to your site via a File Transfer Protocol (FTP) client such as FileZilla. Alternatively, you can access your WordPress files through the file manager in your hosting account.

For this tutorial, we’ll be working with FileZilla. It’s completely free and straightforward to navigate. If this is your first time using this program, you’ll need to download it to your computer:

To connect to your site, you’ll need to enter your FTP credentials, which you can copy from your hosting account. 

Once you’ve connected, locate and open the wp-content folder. Here, you’ll see a folder called plugins:

Rename this folder to something like “plugins_disable”. Doing so will automatically deactivate all plugins on your site. 

Next, try to reload your website. If you can now access the WordPress dashboard, go back to your wp-content folder and rename the plugins_disable folder to its original name. 

The next step is to find out which plugin is at fault. Start by heading to the Plugins page in your WordPress dashboard. Then, reactivate your add-ons one at a time, refreshing your site after each reactivation until you can reproduce the error. Once you’ve identified the culprit, you can go ahead and delete it from your plugins folder in the FTP client.

2. Increase Your PHP Memory Limit

Alternatively, you may want to increase your PHP memory limit so that you can continue using your favorite plugins and add more features to your site. If you choose this method, you’ll need to manually define a new memory limit for your site’s server. 

Once again, you’ll need to access your website via an FTP client or the file manager in your hosting account. Once you’re connected, find the wp-config.php file, right-click on it and select View/Edit:

This will open the file in a text editor. Next, locate the line that reads “/* That’s all, stop editing! Happy blogging. */.” Before this line, add the following code:

define( 'WP_MEMORY_LIMIT', 'XXXM' );

Note that you’ll need to replace ‘XXX’ with the amount of memory you’d like allocated to the PHP, such as: 

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

This will increase your PHP memory limit to 256MB. When you’re ready, save your file and close it. Then, re-upload the updated wp-config.php file to your site. 

If you’re still encountering the “allowed memory size exhausted” error after increasing your PHP memory limit, then your web host may not allow you to change this setting. If this is the case, you might want to contact your hosting service provider and ask them to increase the memory limit for you.

Conclusion

The “allowed memory size exhausted” error pops up when you reach the PHP memory limit allocated to your hosting account. It is typically caused by a plugin that’s taking up too much memory. While this error prevents you from accessing your WordPress dashboard, it can be straightforward to fix. 

In this post, we looked at two effective ways to resolve the WordPress memory exhausted issue:

  1. Disable and reactivate your plugins to find the one that’s taking up a lot of memory space.
  2. Increase your PHP memory limit by editing the wp-config.php file or contacting your hosting provider for assistance.

Do you have any questions about how to fix the WordPress memory exhausted error? Let us know in the comments section below!

Will Morris

Recent Posts

How to Reset WordPress: Step-by-Step Guide for Beginners

Are you looking to reset a WordPress site and start fresh? Reset a WordPress Site…

5 days ago

WordPress vs. Wix: Which Platform Is Right for You?

Ready to build your online presence? Choosing the right platform between Wix vs. WordPress is a crucial first…

5 days ago

How to Change Favicon in WordPress: A Step-by-Step Guide

Changing your favicon in WordPress is a small yet powerful way to improve your website’s…

5 days ago

How to Embed a PDF in WordPress

Have you been searching for the easiest way to share PDF files directly on your…

1 week ago

How to Add Social Media Icons to WordPress Header: A Complete Step-by-Step Guide

Ever notice how professional websites seamlessly display social media icons in their headers? Adding social…

1 week ago

How to Clear Cache on WordPress: A Step-by-Step Guide

WordPress caching is an incredible tool for boosting your website’s performance. It helps deliver faster…

1 week ago