WordPress

Increasing PHP Memory in WordPress

If you are using WordPress with the default installation settings and you want to increase the PHP memory allocated to your web server.

In that case, it’s recommended that you increase the memory assigned to the WordPress core. It should be easy to increase the memory of WordPress with the default installation settings.

Why Increase PHP Memory Limit in WordPress?

While installing a theme, or plugin or importing custom files such as XML in WordPress, you might have faced a problem of memory limit being run out.

This could be very frustrating especially for WordPress beginners who do not have any idea what happens behind the scene and how to fix it.

In this post, I will guide you on how to increase the PHP memory limit in WordPress.

What is WP Memory Limit?

The WP_MEMORY_LIMIT option allows you to specify the maximum amount of memory that can be consumed by PHP. This setting may be necessary for the event you receive a message such as “Allowed memory size of xxxxxx bytes exhausted”.

This setting increases PHP Memory only for WordPress, not other applications. By default, WordPress will attempt to increase the memory allocated to PHP to 40MB (code is at the beginning of /wp-includes/default-constants.php) for the single site and 64MB for multisite, so the setting in wp-config.php should reflect something higher than 40MB or 64MB depending on your setup.

WordPress will automatically check if PHP has been allocated less memory than the entered value before utilizing this function. For example, if PHP has been allocated 64MB, there is no need to set this value to 64M as WordPress will automatically use all 64MB if need be.

Please note, this setting may not work if your host does not allow for increasing the PHP memory limit–in that event, contact your host to increase the PHP memory limit. Also, note that many hosts set the PHP limit at 8MB.

Increase PHP Memory to 64MB

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

Increase PHP Memory to 96MB

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

Administration tasks require more memory than usual operation. When in the administration area, the memory can be increased or decreased from the WP_MEMORY_LIMIT by defining WP_MAX_MEMORY_LIMIT.

define( 'WP_MAX_MEMORY_LIMIT', '256M' );

Please note, this has to be put before wp-settings.php inclusion.

I hope this post helps you in fixing problems on your website arising from the limited memory limit set by your web host.

Show More

Related Articles

Leave a Reply

Back to top button

Adblock Detected

Please turn off Ad Blockers to continue.