สำนักวิทยบริการและเทคโนโลยีสารสนเทศ (สวส.)

Office of Academic Resources and Information Technology

วิธีแก้ Fatal error Allowed memory size สำหรับ Drupal

 
Increase PHP's memory limit, e.g. to increase it to 128M you could try adding:
 
  • memory_limit = 128M to your server's main php.ini file (recommended, if you have access)
  • memory_limit = 128M to a php.ini file in the Drupal root
  • ini_set('memory_limit', '128M'); in your sites/default/settings.php file
  • php_value memory_limit 128M in your .htaccess file in the Drupal root
 
    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 128MB 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 128M.
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 web servers.
 
Finding out current PHP memory limit and php.ini location
    To find out the current value of PHP memory limit, navigate to status report (Reports > Status report or http://example.com/admin/reports/status) and scroll down (items are listed alphabetically) to PHP:
Status report
Two lines above that, you can see PHP version info; 'more information' link takes you to phpinfo() page, where you can find out the location of php.ini file:
phpinfo()
(example from a Linux (Ubuntu) system)
 
ที่มา : https://drupal.org/node/76156