How to increase php memory limit for drush in a shared host

Most of the shared hosting providers will only allow very low level of PHP memory for the command line. In most cases it's 64M. So here is a simple work around to increase it's value without much trouble.

Prerequisites : You should have SSH access to the webserver.

Run following commands on your command line.

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

You'll see the amount of memory assigned to the PHP cli. Is it 64M or 128M?. Let's increase it.

Run following command.

vi  ~/.drush/drushrc.php

Add these lines to drushrc.php

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

Now run

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

Did you see your new php memory limit is in use?.