How do i increase max memory in wordpress?

Are you seeing an allowed memory size exhausted error in WordPress? This is one of the most common WordPress errors, and you can easily fix it by increasing the php memory limit in WordPress. In this article, we will show you how to fix WordPress memory exhausted error by increasing PHP memory.

How do i increase max memory in wordpress?

What is WordPress Memory Exhausted Error?

WordPress is written in PHP, which is a server-side programming language. Every website needs a WordPress hosting server for it to function properly.

Web servers are just like any other computer. They need memory to efficiently run multiple applications at the same time. Server administrators allocate specific memory size to different applications including PHP.

When your WordPress code requires more memory than the default allocated memory, you get to see this error.

Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 2348617 bytes) in /home4/xxx/public_html/wp-includes/plugin.php on line xxx

How do i increase max memory in wordpress?

By default, WordPress automatically tries to increase PHP memory limit if it is less than 64MB. However, 64MB is often not high enough.

Having said that, let’s see how to easily increase PHP memory limit in WordPress to avoid memory exhausted error.

Increase PHP Memory Limit in WordPress

First you need to edit the wp-config.php file on your WordPress site. It is located in your WordPress site’s root folder, and you will need to use an FTP client or file manager in your web hosting control panel.

Next, you need to paste this code in wp-config.php file just before the line that says ‘That’s all, stop editing! Happy blogging.’

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

This code tells WordPress to increase the PHP memory limit to 256MB.

Once you are done, you need to save your changes and upload your wp-config.php file back to your server.

You can now visit your WordPress site and memory exhausted error should disappear now.

If you are new to WordPress, then take a look at our beginners guide on how to copy and paste code from the web.

We also have a step by step guide on how to find and edit wp-config.php file.

Note: If this solution does not work for you, then this means your web hosting service provider does not allow WordPress to increase PHP memory limit. You will need to ask your web hosting provider to increase your PHP memory limit manually.

That’s all we hope this article helped you solve WordPress memory exhausted error by increasing PHP memory limit. You may also want to see our step-by-step beginner’s guide to troubleshooting WordPress errors.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPBeginner is funded, why it matters, and how you can support us.

How do i increase max memory in wordpress?

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi. We have been creating WordPress tutorials since 2009, and WPBeginner has become the largest free WordPress resource site in the industry.

Reader Interactions

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 then we’ll walk you through some of the options for fixing it.

Let’s get to work!

An Introduction to WordPress Memory Limit Errors

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 too 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 problems – the WordPress memory limit error. This can also be known as a ‘PHP memory limit error’ and often looks something 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 arise when you take specific types of actions on your site, such as:

  • Installing and activating a new theme or plugin.
  • Uploading images and other media to your site.

If you’ve run into this error on your own WordPress site, don’t worry. The reasons behind it are simple – let’s talk a little more about why it occurs.

You've reloaded a page and, boom, the PHP memory limit error slaps you on the face. Here are all the things you need to investigate to fix it🕵️Click to Tweet

Why You’re Seeing a WordPress Memory Limit Error on Your Site

The clue to the cause of the ‘memory limit’ error is right there in the name. 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.

Naturally, purchasing a higher-tier hosting plan provides more space and memory for your website. Many first-time site owners start out with basic shared hosting plans, which isn’t necessarily a problem. However, it does mean your allocated memory will be on the low side.

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 Check Your Current PHP Memory Limit

If you’re running WordPress 5.2 or above, you can use the Site Health tool to check what the current PHP memory limit is on your site. In your WordPress dashboard, go to “Tools” → “Site Health” → “Info” and scroll down to the server section. Here you can see that the PHP memory limit is on your server.

How do i increase max memory in wordpress?
Check PHP memory limit

If the amount is low, say 32M, there’s ultimately only one fix for this issue: you need to increase the amount of memory allocated to your site. However, there are a few different ways to approach this.

How to Resolve 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: Increase the PHP Memory Allocated to Your Website
  • Option 2: Upgrade Your Website’s Hosting Plan

Option 1: Increase the PHP Memory Allocated to Your Website

It may seem simple, but sometimes the obvious solution is the best one. If your site has run out of memory, the easiest thing to do is increase how much memory it has access to.

Obviously, how far you’re able to increase the limit will depend on your hosting provider and plan. We’ll talk more about this aspect in the next section. However, it’s not uncommon for your site to be using a smaller amount of memory than it actually has available.

Want to know how we increased our traffic over 1000%?

Join 20,000+ others who get our weekly newsletter with insider WordPress tips!

Subscribe Now

Your site’s current memory limit is set in its wp-config.php file, and this may or may not match up to the limit allowed by your provider. The first step, therefore, is to try and increase your PHP memory allowance by editing the file.

Using an FTP Client to Access Your Site’s Files

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:

How do i increase max memory in wordpress?
FileZilla

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. If you run into trouble, you should be able to reach out to your provider, who can tell you where to locate your credentials.

Finding Your wp-config.php File

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

How do i increase max memory in wordpress?
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:

How do i increase max memory 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.

Increasing Your Site’s Memory Limit

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

How do i increase max memory in wordpress?
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 contains. In most cases, 256 MB should be sufficient. If you don’t find the line, you can paste it in right before the part of the file reading: “That’s all, stop editing! Happy blogging.”

Then, 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 it 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 need to try a different approach.

However, before we move on, it’s worth noting that some hosts may not let you access your site through an FTP client. In this scenario, you can often change your memory limit manually through other means, such as by using cPanel. For more details on your alternative options, check out this knowledge base article.

Option 2: Upgrade Your Website’s Hosting Plan

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

If you’ve tried increasing your site’s memory limit as described above with no luck, the first step would be to find out how much memory your current hosting plan permits. You may be able to find this on your provider’s website or in your hosting dashboard. Otherwise, contact your provider directly and they should be able to tell you.

If you’ve reached your site’s maximum memory limit but you’re still seeing the WordPress memory limit error, your only real option is to change your hosting. This may involve switching providers, upgrading to a higher tier, or opting for a different type of plan.

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:

How do i increase max memory in wordpress?
Kinsta plans

Not only is it fast and secure but all of our plans set a default memory limit of 256 MB. For most sites, this should be more than enough. However, if you ever experience any memory-related issues on Kinsta, just reach out to our support team and we’ll help get 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.

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 pretty straightforward.

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

  1. Increase your site’s memory limit manually, using an SFTP client or a similar tool.
  2. Upgrade to a hosting plan that offers more resources for your site to use.

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


Save time, costs and maximize site performance with:

  • Instant help from WordPress hosting experts, 24/7.
  • Cloudflare Enterprise integration.
  • Global audience reach with 35 data centers worldwide.
  • Optimization with our built-in Application Performance Monitoring.

All of that and much more, in one plan with no long-term contracts, assisted migrations, and a 30-day-money-back-guarantee. Check out our plans or talk to sales to find the plan that’s right for you.

What is the maximum WordPress memory limit?

WordPress has a 32MB memory limit by default, but some hosting providers increase this to 64MB for all customers.

How do I increase memory limit on my website?

You can increase your host memory limit by following any of the five methods mentioned below..
Most Recommended: Just Contact Your Host. ... .
Increasing Memory Limit via PHP.ini file. ... .
Alternative to editing PHP.ini through wp-config.php. ... .
Changing memory Limit in wp-config.php. ... .
Modifying the .htaccess file..

How do I check my WordPress memory limit?

If you're running WordPress 5.2 or above, you can use the Site Health tool to check what the current PHP memory limit is on your site. In your WordPress dashboard, go to “Tools” → “Site Health” → “Info” and scroll down to the server section. Here you can see that the PHP memory limit is on your server.

How do I fix a memory exhausted error in WordPress?

How to fix the WordPress memory exhausted error on your HostPapa account.
The solution is to increase your PHP Memory limit. ... .
Now select File Manager..
Locate the wp-config. ... .
Save the file, and head back to WordPress – the memory error should now be resolved. ... .
Now click Switch to PHP options..