Hitting Drush Memory Limit

We love Drush, Drupal's all-purpose command-line tool, for people who can't stand checkboxes. It's fast, efficient, plays nicely with Version Control Systems like CVS, SVN and Git, and even cleans the kitchen sink. However, after moving our DrupalEasy.com site to a new server we encountered a minor snag. When trying to run even the simplest of Drush commands, we were faced with the following error:

Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 311296 bytes)

As part of our normal server set up routine, we always head over to the php.ini file and increase the default memory limit, which is 16MB by default. So why are we getting this command-line version of the "white screen of death" now? A call to our local System Administrator revealed the problem, and a speedy solution.

Turns out, when you use PHP from the command line, a different php.ini file is used. Drush runs in this special mode, sometimes referred to as CLI. The configuration file on our server was stored at:


Open this file in your favorite command-line editor, such as vi and search for the line containing the word memory_limit It is near the heading Resource Limits. Then change the limit to something pretty large (but not to a comical degree). Ours reads:

memory_limit = 128M;

For more information, see the official Drush site.