Skip to content Skip to navigation
Back to the main support

How to increase the PHP memory limit for WordPress sites

If you encountered the fatal error below, it probably means your server is running out of memory:

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 59072 bytes)

Why does this happen?

Any web server has limited hardware capacity. Each host allocates you more or less memory. Some are more restrictive than others. This has the effect of getting this kind of error after activating a new plugin within your WordPress, for example, because your memory request has exceeded the authorized limit.

How to fix this?

Simply edit your wp-config.php file using a SFTP client like Filezilla or Transmit. It’s located at the root directory of your WP installation.

Then find the lines below and change the value to 512M.

If you don’t see these lines, add them at the beginning of the file:

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

Usually 256M is enough for the large majority of website. However, for e-commerce sites using WooCommerce with multilingual support, 512M is recommended.

If you need more memory, there is probably something wrong with your code, eg, an infinite loop.

It doesn’t fix the error!

We invite you to contact your host. They are probably handled this using a php.ini or .htaccess file.