parallax background

How to increase the WordPress memory limit

How to add a responsive Google Maps widget to your site
February 19, 2020
How to see the current WordPress version you have
February 26, 2020
 

WordPress is an excellent choice for those looking for an intuitive and useful platform for managing and making their website; it is open-source, very flexible, and scalable, but it does have some drawbacks. Working with WordPress can be difficult for beginners at the start, especially with all the technical details it entails, one of which is the WordPress memory limit.

If your WordPress memory is exhausted very easily, it’s time to take some action.This is confusing if you don’t know what is happening. A good and easy solution to this problem is to increase the WordPress memory limit.

This tutorial will show you how to increase the WordPress memory limit relatively easily even for beginners..

About WordPress Memory Limit

 

If you tend to expand your website with new content, images, visual content, plugins, and various scripts, the performance of your site will decline, and eventually, you will reach the WordPress memory limit.

Then you will most likely get a PHP memory limit error often quite familiar to seasoned WordPress users. The error occurs when WordPress doesn’t have sufficient memory to complete the request you asked from it. The more plugins and scripts you use, the more memory it will use and even more memory if the plugin is poorly optimized, or if the installation takes too much memory.

Once you reach that WordPress memory limit, running your site becomes a problem. Your website requires a certain amount of memory to store all your files, including all the visual content, plugins, database, code, themes, and much more. Unfortunately, the WordPress memory limit restricts the amount of usable memory.. You can, however, increase it quite easily.

 

Your hosting server also imposes a limitation. The provider who hosts your site will provide you with a certain amount of resources (memory) to manage all your files. Therefore the amount of memory you receive is largely dependent on your hosting provider.

You should carefully consider which provider you choose for your website. Choosing a high-quality provider makes sense, especially if you plan to expand your website over time, and consequently use more memory. For beginners, choosing more expensive plans is probably not ideal; however, with time, it might be a good option to consider expanding.

How to Increase the WordPress Memory Limit

It is relatively easy to increase the WordPress memory limit.. It is a very clear problem and the solution is also pretty clear, so there is no need to go very deep into its cause..

Three different methods are provided to fix this problem:

Method #1: Increase the PHP memory allocated to your website by changing the wp-config file

 

The most intuitive and relatively easy solution is basically to allocate more memory to your site than what has been allocated.

However it will only work if you still have space to increase the memory with your hosting provider.

You normally use much less memory than the provider actually offers. There are different memory limits, depending on the provider, and you need to set it regardless of what is offered.

You can find your allocation in the wp-config.php file, so access that file first. The memory limit in this file might not be the same as that of the provider. You will need to change the file in such a way that it increases the WordPress memory limit.

This file is not built-in with your website but comes separately as a part of your installation, so you need to locate it in the root folder of your WordPress site. You need to use an FTP client or other suitable file manager software.

To increase the memory to 256MB, for example, you will need to add this line into the file, right before the line that says “Happy Blogging”:

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

With this command, you will define the WordPress memory limit to 256MB, but you can change the value to your liking (as long as it is enough for your provider to handle.)

The last step is to save the file and upload it again to the server. Now you should be able to access more memory.

Method #2: Editing the PHP.ini File

 

If editing the wp-config.php file hasn’t worked, you can try to change your server’s settings instead of the WordPress files.

If you can access the file, then you will be able to find the file within your root folder, or where your service provider keeps it.

Go to your wp-admin folder, and try to locate the php.ini file, or the php5.ini file. If the file is there, which is unlikely, double-click on it and download it to your PC. Open it.

If the file isn’t there, then you will have to open the text editor, and open the php.ini file. Then, locate the line where your memory is specified with the memory_limit and the M values. You will need to change those lines:

If the line shows 64M as the memory limit, change it to 256M with this line:

Memory_limit = 256M

Hopefully, this will work. Please note this option doesn’t apply for shared hosting, which does not permit access to the PHP.ini file. The next method will help those who use shared hosting.

Method #3: Edit the .htaccess file

 

If you haven’t yet been able to change the WordPress memory limit by altering the php.ini or wp-config files, you can try changing the .htaccess file. This file will normally be a hidden file, so first you need to make the file visible within your root folder.

Then double click on the file and download it to your computer. Locate the line where your memory limit is specified, and change it by adding this passage of code; if you can’t locate it, then add it anyway:

php_valuememory_limit 512M

This will change the limit to 512MB. Next, you will have to save the file and overwrite the original. Next, refresh the FTP client, and refresh your site.

If the solution doesn’t work, then you will have to delete the line and try another solution. If it works, save the file to your root directory.

Backup Method: Contact Your Host

 

If you want to increase the WordPress memory limit, and the other methods haven’t worked, you can try contacting your host provider to give you a solution.

In some cases, you will not be able to do it manually, and your provider will have to do it for you. In some cases, this is the easiest and best solution, especially for those with shared hosting.

because you can’t access the php.ini file, where you can normally make the changes by yourself. If the hosting isn’t allowing you to increase the limit, then the only solution might be to change the hosting provider, or upgrading to a higher tier with your current provider.

Ending thoughts on WordPress memory limit

Changing the WordPress memory limit is relatively easy if you follow these steps. The options are to change your php.ini file or your wp-config file. In some cases, you will have to alter the .htaccess file. Finally, you can contact your host to increase it for you, or change the hosting provider.

If you enjoyed reading this article about WordPress memory limit, you should read these as well:

Albert Ślusarczyk
Albert Ślusarczyk
As the co-creator of Be Theme, I am a strong believer in designing with care and patience. I pour my energy, time & knowledge into perfecting the theme for our 157,000+ customers.

Comments are closed.

Free cheat sheets available

Subscribe to download a set of cheat sheets for CSS, JS, and HTML

You'll receive an email with the cheat sheets in an instant.