Increasing the WordPress Memory Limit

You are here:

To address memory limit issues, there are four paths:

 

1. Via PHP.ini file

You can directly increase the PHP Memory Limit if you’ve access to the PHP.ini file. Most small Shared hosting servers won’t give you access to the PHP.ini file. But some servers allow you to create a duplicate PHP.ini in your respective site Directories whose data/values will override the default PHP.ini values. To do that you just need to create a file with the name ‘php.ini’ in the directory where your WordPress site is installed. In that just add the command

memory_limit = 512M

in it to increase the Memory Limit to 512 MB.

 

2. Via wp-config.php

If you don’t want to mess with the PHP.ini file, then you can go for this method. In this, you won’t be needing to create an extra file in your Directory. Just Adding

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

in your ‘wp-config.php’ file would increase your PHP Memory Limit to 512 MB.

Or you can also add this line:

ini_set('memory_limit','512M');

in wp-config.php file to do the same job.

 

3. Via .htaccess

A Default WordPress Installation won’t have a .htaccess file. But in case you already have it for some purposes like ‘301 Redirection’, just add the command

php_value memory_limit 512M

in your ‘.htaccess’ file and your memory limit will increase to 512 MB.

 

4.Contact Your Host

Should you not feel comfortable in trying the above methods, or the above did not work for you, you need to talk to your hosting about having them increase your memory limit.

Last Updated On February 27, 2018