Blog

Increase PHP Memory limit – that’s one of the most popular search terms for WP usrs. The default memory limit for WordPress is 32MB. It is very common to get Memory Size Exhausted Error with certain plugins or themes. The fatal error message looks like:

Fatal Error: Allowed Memory size of xxxxxxxx bytes exhausted….

This type of error arises because your Host’s PHP Memory limit is quite less than what is required by the process to perform its functions.

Well in that case, you will have to increase PHP memory limit. You can follow any of these 3 tips to increase the PHP Memory limit:

Change Memory limit in php.ini File

Editing php.ini file is the most common and easiest way to increase memory limit only if you have direct access to PHP.ini file. Many Shared hosting providers doesn’t give you direct access to the PHP.ini file. In that case you have to create you own php.ini file in the directory where your WordPress site is installed. Or you might need to contact your web host.

Add the following line of code within your php.ini file

memory_limit = 64M 

This would increase the memory limit to 64 MB.

Change Memory limit in wp-config.php File

There is no need to create any extra file in your directory. This option is best for you if you don’t have direct access to php.ini file. To increase memory limit via wp-config.php file, simply add the following line of code in your  wp-config.php file:

define (‘wp_memory_limit’, ‘64M’) 

This would increase PHP memory limit to 64MB. Still if you get any fatal error message then you can contact with your host. This is because they give you direct access to their php.ini file to increase memory limit.

Edit your .htaccess file

When you install WordPress at beginning you don’t have .htaccess file. In such case you have to create it by your own to increase memory limit. If you already have .htaccess file then simply add the following code in your .htaccess file:

php_value memory_limit 64M

This would increase PHP Memory Limit to 64MB.

If you are using too many plugins then you will definitely have to increase your maximum memory limit which you can easily do by any of the methods listed above.

About author

Kriti Jain

Kriti is a passionate blogger and WordPress wanderer. She explores WordPress everyday and shares her findings with the web world.

  1. Hello Kriti,
    Thanks for this post! It is clear and uncomplicated.
    I feel that I could do what you suggest, except that I am unable to to logon to the site as the following error message pops up each time I try to launch the blog…

    Fatal error: Allowed memory size of 41943040 bytes exhausted (tried to allocate 30720 bytes) in /data/20/1/160/138/1975627/user/2157774/htdocs/gsblog/wp-content/plugins/jetpack/modules/widgets/image-widget.php on line 76
    Any thoughts as to how to get around this?
    Thanks for your help!
    Yvonne

    • Hello Yvonne,

      You should use FTP to edit wp-config.php to increase the memory limit. That should solve this error.
      Other wise try deactivating Image Widget module in Jetpack.

  2. hey, is there any downside to upgrading your memory limit? ive been setting a lot of my sites to 256mb lately and am curious if there could be any possible negative impact.

    thanks!

  3. There is no ‘Down Side’ too increasing your WordPress memory, this does have some impact on your hosting server memory resources however, especially if you are running multi-sites Or have multiple WordPress Installations on ‘Add on’ Domain’s all being hosted on one individual server but no major issues! – I would recommend using WP Super Cache or WP Rocket Cache Plugins if you do increase your WordPress memory limits.

    Hope this helps,

    Conor @ Complete Web Solutions Club.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>