Type to search

How to Increase WordPress Memory Limit [Fast & Effective Ideas]

WordPress is the most popular website building platform on the internet. It occupies a major share in the market. Their coding is mostly done in the PHP programming language. As a result, it can often cause some errors. One such error occurs when a piece of code exceeds the WordPress memory limit

What is WordPress Memory Exhausted Error?

Usually, a modern website consists of a load of applications. It is done to either increase the website’s functionality or make a user stay longer. Therefore, these applications require some amount of memory to execute. 

As a result, users face the WordPress memory exhausted error when the application requires more space than what was allotted. Generally, WordPress allots up to 64 MB for running such applications. 

Therefore, the users face the error when an application or scripting code exceeds the 64 MB mark. Usually, memory is equally allocated among the different applications on a website. 

Subsequently, you need to increase the WordPress memory limit to resolve this error. It is one of the most common errors faced by WordPress users. It can often be annoying and troublesome to deal with.

Furthermore, this error can cause the dreaded ‘White screen of death’, ‘500 internal error’ and other such errors. These errors can stop the website from functioning normally. Furthermore, your website may not be displayed at all.

You can easily increase the WordPress memory limit by changing a few values of certain files in the website’s root directory. 

Where to Find these Files?

You need to have an FTP client to access these files. There are many available for free including the ones provided by WordPress themselves. In addition, you can use Windows Explorer as well. 

The files that you need to alter are mentioned below. 

  • wp-config.php
  • PHP.ini
  • htaccess

As a rule, you should always download and make a backup of these files before altering them. They are important and any misconfigurations could result in an error. In addition, these files are created during the installation process. 

How to Increase WP Memory Limit

There are three easy ways to increase WordPress memory limit. All you need to do is add a line of code into the file. Generally, either one of the following changes will do the trick for you. 

Solution 1 – wp-config.php

This is the most basic way to increase WordPress memory limit. Therefore, try this solution before you try the other methods. Follow these steps to increase your allotted memory. 

  1. Open an FTP Client and navigate to your website’s directory. 
  2. Enter your admin login credentials. Usually, it is provided by your web host provider. Contact them if you do not have your login info. 
  3. Go to the root folder of your website. Here, you will find a wp-config.php file. 
  4. Right-click and open it in a text editor. Scroll down to the end of the file until you see “/* That’s all, stop editing! Happy blogging. */”. 
  5. Next, add the following line of code just above this line.
    • define( ‘WP_MEMORY_LIMIT’, ‘256M’ ); 
    • define(‘WP_MAX_MEMORY_LIMIT’, 512M’);
  6. Save your changes and exit the file. 
  7. Open your website and check if you’re still seeing the error. 

Solution 2 – PHP.ini 

Generally, your WordPress memory limit should be increased using the above solution. However, you can try the following if you’re still facing the exhausted memory error. 

  1. Go to your website’s root directory using an FTP client. Here, find a file with the name –  PHP.ini. 
  2. Right-click and open it using a text editor. Here, you need to add the following lines of code.
    • memory_limit = 256M ; 
    • upload_max_filesize = 14M
    • post_max_size = 16M
  3. Press Ctrl and the letter ‘S’ at the same time. Exit the file. 
  4. Check if the memory exhausted error has been resolved.

Solution 3 -.htaccess 

Finally, you can follow this solution if the above solutions did not work for you. Here, we will find and change the .htaccess file located in the website’s directory. You can do this by following the steps below. 

  1. Right-click on the .htaccess file and open it using a text editor. 
  2. Add the following codes into the file.
    • php_value memory_limit 256M
    • php_value upload_max_filesize 14M
    • php_value post_max_size 16M
  3. Save these changes and close the file. 

These methods will increase the WordPress memory from 64 MB to 256 MB. Therefore, you should not WordPress memory exhausted error following these changes. You should copy and paste the backup files in the root directory if you face a critical error. 

Conclusion 

To summarize, you must be able to increase your WordPress memory limit following the above solutions. Usually, you might still face this issue in certain cases. This occurs when your Web Hosting service provider manually restricts the memory limit.  

In this case, you need to contact them to allot you more memory. Similarly, you can find the applications which are taking more space. You can get rid of memory exhausted error by simply removing such applications. However, it is always beneficial to increase your WordPress memory limit. Oftentimes, they do mention it in their plans and you may need to upgrade.