How to increase PHP memory in WordPress?

increase php memory limit in wordpressWhen PHP memory consumption exceeds the allocated memory, you will get “Allowed memory size of xxxxxx bytes exhausted” or “500 Internal Server Error” .You can increase the PHP memory allocation using WP_MEMORY_LIMIT option.

By default, WordPress increases the allocated PHP memory to 40MB for a single site and 64MB for multisite. You can check the default memory allocated to PHP at the beginning of /wp-includes/default-constants.php settings.

If the default allocated memory is 64MB, then you don’t need to set WP_MEMORY_LIMIT option to 64MB. So, WP_MEMORY_LIMIT setting in wp-config.php should have value more than 40MB or 64MB depending on your site setup. Add below line (64MB or 96MB) in wp-config.php file.

To increase PHP memory to 64 MB

To increase PHP memory to 96MB

Notes:

  1. Above line should be added above /* That’s all, stop editing! Happy blogging. */ in wp-config.php file. [See how to edit wp-config.php file]
  2. This setting may not work if your host doesn’t allow increasing PHP memory limit. Contact your hosting provider to do that.

About the Author

SRINI S

A passionate blogger. Love to share solutions and best practices on wordpress hosting, issues and fixes, excel VBA macros and other apps