Faced with the
Fatal error: Allowed memory size of millions of bytes exhausted (tried to allocate a couple of bytes)
message on practically every conceivable Drush operation, thought it was time to invest in my dev environment to sort my Mac out...Turns out that the php.ini file used by your local web server is different to the one Drush uses on the command line. My local development server usually runs with
memory_limit=512M
(although hosted sites usually run with 256M or less). To find out which version of PHP Drush uses,
drush status
may help. However, which php
may give you the best answer: if it's /usr/bin/php
and your Drush status PHP Configuration is blank, chances are PHP is running with a miniscule amount of memory resource for CLI-issued commands.
In which case you need a new php.ini file in your /etc folder to give Drush more beef. There are already default ones in this folder, so just copy one of these and edit.
cd /etc
sudo cp php.ini.default php.ini
sudo chmod 666 php.ini
Then edit your new php.ini file and set
memory_limit=512M
in the php.ini file.If you need more help on understanding what php.ini is all about, there's a useful article at http://drupal.org/node/207036 and explains the various tweaks to help Drupal and Drush work well. Please note, not all hosting providers will allow you to adjust php.ini, especially the cheaper, shared hosting accounts.
No comments:
Post a Comment