how to increase php memory limit for drush without access to php.ini

I recently found myself trying to use drush to set up a Drupal 6 install on a server where I did not have root access. I kept getting errors along the lines of this:

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

I didn't have permission to edit the php.ini file for php_cli, so I had to find another workaround. The solution's pretty simple and comes courtesy of the drushrc.php file.

drush looks in a list of locations for a config file, and the example.drush.php which you'll find inside includes in your drush directory contains the following instructions:

 * Rename this file to drushrc.php and optionally copy it to one of
 * five convenient places, listed below in order of precedence:
 * 1. Drupal site folder (e.g sites/{default|}/drushrc.php).
 * 2. Drupal installation root.
 * 3. In any location, as specified by the --config (-c) option.
 * 4. User's .drush folder (i.e. ~/.drush/drushrc.php).
 * 5. System wide configuration folder (e.g. /etc/drush/drushrc.php).
 * 6. Drush installation folder.

I simply followed these instructions (going for ~/.drush/drushrc.php in this case), and added the following line to the end of the file:

ini_set('memory_limit',          '128M');

You can check that this is getting picked up like so:

drush php-eval 'print ini_get("memory_limit")' ;

...and the real proof of the pudding is that I'm no longer getting the memory exhausted error messages.


Works drush 5.0 dev

thanks worked great with Drush 5.0 dev version (


Also, you can drop a override php.ini in ~.drush/ or /etc/drush/ according to the block starting in line 67 in


Works a charm, thank you

ways to increase php memory

there are many ways to increase php memory for details check at