Steps to Increase WordPress PHP memory limit

Do you get a WordPress error that says “Allowed memory size exhausted”? and Is it saying to increase your PHP memory limit? This article helps you to know What is the WordPress PHP memory limit and How to increase the WordPress PHP memory limit.

What is WordPress PHP memory limit?

PHP is a dynamic programming language that can process WordPress interrogations, perform calculations, and much more. The PHP server-side programming language helps to create websites. PHP requires memory to do so.

The default memory limit of WordPress is 32MB, but it’s normal if you are in need to increase it. For eg, WooCommerce requires 64MB of  WordPress memory limit.

As WordPress hits the default memory limit, it will try to increase it to 40MB for single-site installations and for multisite installations 64MB. If it is not enough, a fatal error message will occur.

Unless you installed a plugin that requires more memory, a memory limit of 128MB should suffice for most pages. Install the Server IP & Memory Use Display plugin to see how much memory each plugin consumes.

How to increase WordPress PHP memory limit

Here are some ways to adjust memory limit by yourself. And this is not basic, It requires advanced knowledge, Be aware. Here are some ways to accomplish your goal:

  1. Edit your wp-config.php file
  2. Edit your PHP.ini file
  3. Edit your .htaccess file
  4. Use a plugin to memory increase
  5. Contact your hosting provider

Edit your wp-config.php file

WordPress PHP memory limit
Look through it until you find this below line:

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

Next, change it to read define(‘WP_MEMORY_LIMIT’, ‘128M’); You can add as high as 256MB, but in most cases, you do not need this much memory.

Edit your PHP.ini file

WordPress PHP memory limit
If the above changes don’t solve your problem, you have to deal with the problem in server settings.

You can’t access your PHP.ini file if you are using the shared hosting. If you have access to the PHP.ini file, It’s most likely in the root folder, but the file location varies by the host.

Here are the steps you have to follow:

  1. Find your php.ini file. If you are unable to find it, simply create your php.ini file and save it in the WordPress installation’s root directory.
  2. Use any editor and edit your php.ini file.
  3. Look through the line that says ‘memory limit = 32M’.
  4. Modify the 32M or some other number to the preferred limit (e.g. 256M or 512M).
  5. Restart your server or localhost after saving the changes.
memory_limit = 256M ; Maximum amount of memory a script may consume (64MB)

Important: If you have created your own php.ini file, you have to add the following line to it:
memory_limit = 256M (or 512M)

Edit your .htaccess file

WordPress PHP memory limit
If you don’t have access to PHP.ini, try adding this to a .htaccess file: as the last step. Since it is a secret file, the .htaccess file begins with a mark. Check to see if the SFTP file manager has hidden some files from view. if you don’t find them in your root folder.

Here are some details you have to add to your .htaccess file to increase the WordPress PHP memory limit

php_value memory_limit 256M

Use a plugin to memory increase

You can increase the WordPress PHP memory limit by using the following plugins, such as

  1. WordPress WP Memory Limit
  2. Memory Usage
  3. Server Memory
  4. Health plugin

These plugins work with WordPress version 5.2 or higher and let you change the available PHP memory without the need to access or modify files.

Contact Your Host Provider

If the above methods did not work or if you are not feeling comfortable trying the above methods, you have to talk to your hosting about increasing the WordPress PHP memory limit.

Are you looking for Feature-rich & trendy websites? Without delay, Find us here

Leave a Reply

Forgot Password