How to increase WordPress memory limit

Sometimes during upgrade of WordPress or when you install a plugin you can experience Allowed memory size of xxx bytes exhausted.

It usually looks something like this:

Fatal error: Allowed memory size of 33673532 bytes exhausted (tried to allocate 2358947 bytes) in /home2/xxx/public_html/wp-includes/plugin.php on line xxx

WordPress comes with a default memory limit of 32MB. So if you encounter this error try increase the memory limit. Increase the memory limit in steps of 8MB.

There are a few ways of solving this problem and which solution that works for you depends on your host.

php.ini

If you have access to your php.ini file, find this line and increase the number.

memory_limit = 32M

.htaccess

In your .htaccess file, increase the value or add this line if you don’t have it already.

php_value memory_limit 32M

wp-config.php

It is also possible to increase the memory from wp-config.php file.

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

If none of the above solutions work for you, ask your host.

Remember that you should never change a WordPress core file. If you do, these changes will be removed each time you upgrade to a new version of WordPress.

About Fredrik Malmgren

Fredrik Malmgren is an entrepreneur, project manager and developer specialized in WordPress. Read more about me or get in contact with me. You can also find me on Twitter. (@fredrikmalmgren).
This entry was posted in Tutorials, WordPress and tagged , , . Bookmark the permalink.

One Response to How to increase WordPress memory limit

  1. Pingback: Latest news from Magnus Attefall 11/29/2011 | Läsvärt | Attefall Allehanda - Nyheter och recensioner

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=""> <strike> <strong>