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

You, DrupalDrushPHP
Back

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 web server.

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?.

© Heshan Wanigasooriya.RSS

🍪 This site does not track you.