While working with WordPress , often when we upload large size themes and plugins we face a problem of PHP memory limit in WordPress. WP_MEMORY_LIMIT through which we can increase or decrease the size of PHP memory limit.
You will find this WP_MEMORY_LIMIT in a file wp-settings.php in root directory of WordPress. By default nothing is defined in the file regarding WP_MEMORY_LIMIT but if you want to increase the memory limit, you need to write a line for the memory limit after this comment in wp-settings.php
// Set initial default constants including WP_MEMORY_LIMIT, WP_MAX_MEMORY_LIMIT, WP_DEBUG, WP_CONTENT_DIR and WP_CACHE.
we need to write below line to to increase the memory limit of PHP for wordpress. To increase PHP memory to 64 MB we need to add this line in wp-settings.php file.
define( 'WP_MEMORY_LIMIT', '64M' );
To increase PHP memory to 96 MB we need to add this line in wp-settings.php file.
define( 'WP_MEMORY_LIMIT', '96M' );
To increase PHP memory to 128 MB we need to add this line in wp-settings.php file.
define( 'WP_MEMORY_LIMIT', '128M' );
Now this increase decrease in memory of PHP in WordPress depends on use of plugins and themes which you are using in WordPress.
Note: Sometimes these settings do not work due to the limitation of Host, As some hosts do not allow to change memory limit of PHP but most of the hosts have limited the PHP limit at 8MB, So you need to contact your host to increase the memory limit.
0 comments:
Post a Comment