Friday, March 13, 2009

Fatal error: Allowed memory size of X bytes exhausted (tried to allocate Y bytes) in Drupal

That indicates that Drupal needed more memory than PHP was allowed to give it. 

Increase PHP's memory limit, either by adding:
memory_limit = 16M to your php.ini file (recommended, if you have access)
ini_set('memory_limit', '16M'); in your sites/default/settings.php file
php_value memory_limit 16M in your .htaccess file in the Drupal root


Slightly more instructions on increasing PHP memory on your server in the installation guide.

Some hosts allow a PHP.ini in the root of your site. Other hosts will not allow any modification of your capacity at all.

Depending on the amount of modules you have enabled and their 'impact' on the site you may need to increase the memory_limit even more (sometimes to 32 MB or more). Image processing often takes a lot of memory, as can working with any large files. Experiment with what memory value works for your needs.

Clearly, if your error was memory size of 16777216 bytes exhausted (16M) in the first place, then you are going to have to be bumping the limit up even higher than that. Do the binary thing and double it to 32M.

You may need to restart your server before the php.ini settings take effect.

Note: Do not just set an arbitrarily high number just to avoid this potential problem - it may limit your ability to have multiple simultaneous connections run efficiently, and simultaneous connections are important on webservers.

Enjoy ubuntu... ;)

No comments:

kunkun-laptop .... ;)