When 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
define( 'WP_MEMORY_LIMIT', '64M' );
To increase PHP memory to 96MB
define( 'WP_MEMORY_LIMIT', '96M' );
- 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]
- This setting may not work if your host doesn’t allow increasing PHP memory limit. Contact your hosting provider to do that.