There are advantages and drawbacks to using an open-source platform like WordPress. It’s flexible and infinitely scalable, but it also requires you to be comfortable with a certain amount of technical work. This is especially relevant when it comes to performing troubleshooting and resolving some of the errors that commonly arise when you’re using the platform.

On occasion, you’ll run into an error advising that you’ve hit your site’s “PHP memory limit.” This could be confusing at first, especially since you won’t know what caused the problem or how to fix it.

Fortunately, this issue is one of the simplest ones to resolve and should be achievable even for relatively new WordPress users.

In this knowledge base article, we’ll explain what a WordPress memory limit error is, discuss why it might occur on your WordPress site, and walk you through some of the options for fixing it.

Let’s get to work!

What Is the WordPress Memory Limit Error?

WordPress is a pretty stable platform, but it isn’t immune to errors. There are a number of common issues you might run across, such as the infamous ‘White Screen of Death’ or a site stuck in ‘maintenance mode.’

The good news is that most WordPress errors aren’t difficult to troubleshoot and fix. All the same, they can be intimidating to newcomers, especially since they offer little information about what’s gone wrong and how to approach solving the problem.

This brings us to one of the most frequently encountered issues – the WordPress memory limit error. This can also be known as a ‘PHP memory limit error’, and it typically appears as a single line of text on a blank page, like this:

fatal error: allowed memory size of 67108864 bytes exhausted

The error can occur in a number of different circumstances. However, it’s most likely to appear when you take specific types of actions on your site, such as:

Just like anything else, your website requires a certain amount of memory in order to store all of its data. This includes its database and files, all of your content, code added by plugins and themes, and more.

This memory is provided by your hosting server. When you purchase a hosting plan, your site is allocated a specific amount of resources, including the memory used to store your site and enable it to function smoothly for visitors.

As your site grows larger or you start using more complex plugins and scripts, you may eventually hit your memory limit. When it comes to WordPress, this means you’ll end up seeing a PHP memory limit error and won’t be able to complete the action you were trying to take.

How To Fix the WordPress Memory Limit Error (2 Methods)

Unlike many common errors, the WordPress memory limit issue is simple to troubleshoot. It has a very clear cause, so you won’t have to go through a whole lot of trial and error if you want to figure out how it can be fixed.

Instead, there are really only two ways forward when you’ve hit a PHP memory limit on your website. You can increase the amount of memory allocated to your site, or you can opt for a hosting plan that offers more space. Let’s explore when and how you’d want to use either of these methods.

Option 1: Use Quality WordPress Hosting

Each type of hosting will provide a specific amount of resources. However, those resources might become insufficient for your website in time.

Some web hosts don’t enable you to change the WordPress memory limit. This can be due to the type of plan you’re signed up for or because the web host doesn’t give that kind of access to its users.

If you’re using quality WordPress hosting, chances are you’ll never run into this error. This is because any decent web host will allocate more than enough PHP memory for your WordPress website to work properly.

Depending on your circumstances, the best solution to this error can be to switch to a WordPress-specific web host. Alternatively, you might want to upgrade your hosting plan, but only after consulting with support.

For those who started out on a shared hosting plan, it may be time to upgrade to a Virtual Private Server (VPS) or cloud hosting, both of which offer more space and resources. It’s also worth looking for a plan that’s flexible, where you can easily increase the amount of resources allocated to your site as needed.

Here at Kinsta, we offer managed WordPress hosting powered by the Google Cloud Platform:

Kinsta’s managed WordPress hosting plans
Kinsta’s managed WordPress hosting plans

Not only is it fast and secure, but all of our plans come with high PHP memory limits. If you ever experience any memory-related issues at Kinsta, you can reach out to our support team, and we’ll help you resolve the problem.

We even offer free migrations from many other WordPress web hosts. This means you can have your site moved to a new home and eliminate the WordPress memory limit error quickly.

Option 2: Increase the WordPress Memory Limit

If you can’t switch WordPress web hosts at the moment, the next best solution is to try and increase the PHP memory limit manually. How far you’re able to increase the limit will depend on your hosting provider and plan. In our experience, it’s not uncommon for your site to be using a smaller amount of memory than it actually has available.

Increasing your site’s memory limit will require logging into your site directly using Secure File Transfer Protocol (SFTP). If you’ve never done this before, you’ll first need to install an SFTP client – a program that enables you to connect to your site’s files on its server.

We recommend picking up FileZilla, which is free and relatively easy to get started with:

The FileZilla home page
The FileZilla FTP client

Next, you can follow this guide to setting up FileZilla and using it to make a connection. You’ll need your site’s SFTP credentials, which you can usually find in your hosting account.

Once you have FileZilla set up and connected, you should be looking at a screen similar to the following:

Connecting to a WordPress site via FileZilla
FileZilla successfully connected

In the top-right quadrant, you’ll see a list of the folders that contain your site’s files. Look for your site’s ‘root’ folder, which is often either named after your site’s domain or is called public_html or www. Open this folder up, and look for a file called wp-config.php:

Opening the wp-config.php file in WordPress
wp-config.php file in WordPress

This file stores certain information about your site’s database and settings. Therefore, it’s important to be careful not to alter anything other than the specific line of code we’ll be looking at. In fact, it’s a good idea to make a backup of your site before proceeding any further, just in case you accidentally delete or change something important.

With your backup in place, go ahead and open up your wp-config.php file. It should look something like this:

Example of a wp-config.php file
Example of wp-config.php file

Then, look through the file for the following line:

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

Note that the number may be different in your file, as it represents your site’s current memory limit. You may also not find this line at all.

If you do locate the line, go ahead and increase the number it indicates. In most cases, 256 MB should be sufficient. If you don’t find the line, you can paste it right before the part of the file that reads: “That’s all, stop editing! Happy blogging.”

Save the changes to your wp-config.php file, and close FileZilla. Open up your site, and try repeating the action you tried when you first encountered the WordPress memory limit error. If the error no longer appears, you’ve fixed the problem.

If you still encounter the error, you can try opening up your wp-config.php file and increasing the memory limit further. However, if you try this a few times and it doesn’t work, then you may have reached the maximum limit allowed by your hosting provider. In this case, you’ll want to consider migrating to a new web host.

Summary

It can be frustrating to encounter an error on your WordPress site, particularly if it doesn’t offer you much information. Fortunately, the WordPress memory limit error is more accommodating than most. It lets you know exactly what the problem is, and from there, the path to fixing it is straightforward.

You have two main options when dealing with a PHP memory limit issue:

  1. Use quality WordPress hosting.
  2. Increase the WordPress memory limit.

If you have any further questions about how to deal with this specific error, or you’d like to know more about our free migrations, please reach out and our Customer Support Team will be happy to help you out!