If you get memory exhausted fatal errors on your blog, maybe its time to increase memory limit for PHP. In this post, you will find various ways to increase memory limit for WordPress using php and htaccess files.
When PHP scripts get complex they require more memory than regular php files. When PHP is lower than the required limit, you may start getting errors like this:
Sample Error Message:
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 7680 bytes) in /nfs/[…]/mnt/[…]/domains/[…]/html/wp-includes/[…].php on line 314
To resolve this error, you can increase your PHP memory limit using one of the following options:
Increasing php memory limit using
If you have access to
wp-config.php, just define new limit using:
Increasing php memory limit using php.ini
PHP Memory limit is first set inside php.ini file. If you have access to your php.ini, you can change default limit to the new one.
memory_limit = 64M ; Maximum amount of memory a script may consume (64MB)
Increasing php memory limit using .htaccess files
If you don’t have access to php.ini file, you can also use .htaccess files to define new php limit.
php_value memory_limit 64M
Increasing php memory limit using plugin
For users that don’t have file access at all, wordpress released a plugin called Memory Bump to increase memory limit. However, it is not updated for more than 2 years now. Still worth a try if you can’t access files on your hosting server.