That indicates that Drupal needed more memory than PHP was allowed to give it.
Memory increase to 128M:
(This has worked every-time; and used to always work for D6 as well)
Create a new file php.ini, and add the code...
php_value memory_limit = "128M"
and put that file in your Drupal 7 (or D6) root folder.
For step-by-step details, see comment below...
Drupal 7 "Fatal error: Allowed memory size of ...".
- For step-by-step details, see comment below...
If you need more than 128M:
Add the line
to your [Drupal 7 root]/sites/default/settings.php file.
I have yet to need this much memory, but I did achieve
a memory increase to 512M using this slightly more complicated
process that involved temporarily changing the permission level
for that file.
- For step-by-step details see the comment below Drupal 7 memory increase to more than 128M.
End Drupal 7
Increase PHP memory limit
Increase PHP's memory limit, e.g. to increase it to 32M you could try adding:
memory_limit = 32Mto your server's main php.ini file (recommended, if you have access)
memory_limit = 32Mto a php.ini file in the Drupal root
ini_set('memory_limit', '32M');in your sites/default/settings.php file
php_value memory_limit 32Min your .htaccess file in the Drupal root
You can also try Drupal tweaks module.
On most hosts not all of the above methods will work, and some shared hosts will not allow any modification of your capacity at all. Slightly more instructions on increasing PHP memory on your server in the installation guide.
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 web servers.
Reducing Memory Usage
There is no way to know how many or what combination of modules will put any one site over their memory limit. Every module uses a different amount of memory. Core requires memory by itself and requirements for core alone should be understood. see: http://drupal.org/requirements
A frequent example of this error occurs when too much content is retrieved in a single request. This could include using node_load() on a large number of nodes, loading an entire file into a variable (rather than iterating over the file), or creating a large number of dynamic elements on a single page, such as multiple Views blocks or Panels.