Quick Tip: Drupal Drush Out of Memory Error on Ubuntu

Richard's picture

I recently started running into out of memory errors while running Drupal's awesome Drush module from the command line to update a sites modules.

This is odd as on my dev machine I've set up my php.ini to reserve 512MB of RAM (memory_limit=512M). That should be plenty!

I temporally upped the RAM to 2GB(!!) and was still getting out of memory errors when running Drush!

Now, I'm a relative n00b when it comes to Ubuntu and Linux, but a bit of digging around on the web provided a solution:

PHP has *TWO* php.ini files! One for apache (/etc/php5/apache2/php.ini) and one for the cli (/etc/php5/cli/php.ini).

Drush runs from the command line, so you need to up the memory in the cli php.ini

Makes sense, but took me 1/2 an hour to work it out.

Comments

Post new comment

The content of this field is kept private and will not be shown publicly. If you have a Gravatar account, used to display your avatar.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <c>, <cpp>, <drupal5>, <drupal6>, <java>, <javascript>, <php>, <python>, <ruby>. Beside the tag style "<foo>" it is also possible to use "[foo]".

More information about formatting options