How to Fix PHP Memory Limit Errors

Sometimes, you’ll get an error indicating that you’ve reached your site’s ‘PHP memory limit.’ This may scare you because you don’t know what this means. In this post, we will explain what this error means and how you can fix it. We’ll go over a couple of ways to use a few lines of code to boost the maximum PHP memory limit and the maximum upload file size in your WordPress files. Let’s get started!

WordPress Memory Limit Errors

All of WordPress’s processing is done in PHP, including determining what the URL’s web request is, what to get from the database, what files to load and when, verifying user rights, checking settings, obtaining post metadata, calling plugins, and calling the theme. These procedures need the use of memory.


Your hosting server provides this memory. When you buy a hosting package, they give you a certain amount of memory. WordPress’s default memory limit is 32MB, although it’s normal to change it according to your need. There are some plugins that recommend the memory limit to be 64MB or even 128MB or higher in some cases. When WordPress hits the memory limit, you will see that error.  If you want to check your memory limit in the WordPress dashboard, go to “Tools” > “Site Health” > “Info” and scroll down to the server section.

Resolve the Memory Limit Issue

The WordPress memory limit problem is easy to fix. You won’t have to go through a lot of trial and error to figure out how to solve it, especially since the error message you receive tells you! The current memory limit for your site is determined in the wp-config.php file. The wp-config.php file is one of the most important files of your site because it contains all the base configuration details of your site.


Before you make any changes to that file, we recommend you take a backup of that file. Then, you need to find your wp-config file and then edit it. You can do that using a FTP tool. You can use FileZilla, and if you need help with how to set it up, please check the documentation here.  You will likely need to talk to your Website Hosting support if you’re not sure how to connect to your website via FTP.


After you set up and connect FileZilla, you should be able to find the wp-config file inside your site files.

Open the file and look for this line in the wp-config.php file, If you find the line, increase the number of it. In the vast majority of circumstances, 128 MB should be plenty.


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

After changing the number save the file and close FileZilla. Reopen your site and do the same activity you did when the WordPress memory limit problem originally appeared. You’ve solved the problem if it no longer appears.

If you are still facing the issues as before, go ahead increase the memory limit further. That should solve the issue.


However, if you’re utilizing a cheap shared hosting plan, you might not be able to make all of the necessary adjustments to make WordPress work the way you want it to. Each sort of hosting comes with its own set of resources. However, with time, such resources may become insufficient for your website. You may want to change your hosting plans if you have reached the memory limit provided by your hosting provider.

Sign Up For Our Newsletter

This field is for validation purposes and should be left unchanged.