Increasing PHP Memory Limit for WordPress

You are probably here because one of the Plugins you use is asking to increase the ‘PHP Memory Limit’. First, let us know the current limit (your plugin may say this to you) by visiting the WordPress Site Info by accessing ‘Dashboard > Tools > Site Health’ and then selecting the ‘Info’ tab at the top.

Using any of the below 4 methods, you can increase the memory limit of your PHP. If one doesn’t work, try the other. Remember to change the values as per your needs.

Increasing PHP Memory Limit through wp-config.php

Add the below line to wp-config.php just before it says /* Stop Editing */.

define(‘WP_MEMORY_LIMIT’, ‘128M’);
define(‘WP_MEMORY_LIMIT’, ‘128M’);

Increasing PHP Memory Limit through .htaccess

Add the below line to the ‘.htaccess’ file after the default WordPress lines end.

php_value memory_limit 128M
php_value memory_limit 128M

Increasing PHP Memory Limit through php.ini.

Find and edit the below line inside the php.ini file (For any difficulties, contact Host). As far as I know, php.ini cannot be edited in shared hosting plans. Some may allow. Confirm the same with your host.

‘.user.ini’ in some hostings work as same as ‘php.ini’. You can edit that file or add the below line to it. After adding make sure the values have changed by checking WordPress site information. If not changed, revert back the changes. Proceed with ‘.htaccess’ method.

memory_limit = 128M;
memory_limit = 128M;

Increasing PHP Memory Limit through Control Panel

It is also possible to increase the PHP Memory limit by editing the PHP configuration on your hosting account.

The php.ini file, which most Webhosting don’t have access to. In that case, you can change all these values just by editing the ‘PHP Configuration’ File of your hosting. We are pretty much sure either one of these always exists in any web hosting.

Below GIF shows the method in Hostinger.

This method may apply to all the Websites in the same Hosting.

In CPanel Hostings, in the main dashboard, Under Software, you can find MultiPHP INI Editor. Visit that. You can see an interface as displayed below.

CPanel Increase PHP Memory Limit

Here you can edit the values as per your preference. In C-Panel, changes will be applied only for the specific website you choose before editing, unlike custom hostings.

If you need help regarding accessing the wp-config.php and .htaccess, let me tell you that both these files are in your home directory which can be accessed by the Hosting Control Panel or through FTP. Here is a detailed guide on Accessing WordPress Directory Files.

Developers of Plugins and Themes may ask you to share Server Details. Only share what is needed. This Info tab contains sensitive information about your Website.

For any help regarding this article, you can ask us in the comments. We would love to answer.

Please note that our product recommendations are unbiased and targetted to be user-friendly. If you have any recommendations which isn't listed on our site, please feel free to contact us. We would be happy to review it.

Hey Don't Worry! The Email entered will NOT be used for sending NewsLetters. We respect your Privacy 🙂

Inline Feedbacks
View all comments