1

I'm struggling with adding php values into drush.phar. Last time I installed drush I used composer and for that method I could add the php.ini values into the drush.ini, but with the new way to install the drush.phar, the drush.ini doesn't seem to be supported. I've been trying to use the new method of adding php values into the drush.phar, but either it doesn't work or I am doing it wrong. Here's an example of what I tried:

php -d memory_limit=256M /usr/local/bin/drush --php-options=memory_limit=256M

When I try something like that it just gives me the drush help so I'm assuming I've got something wrong.

Here's the example from the drush docs:

php -d foo=bar drush.phar --php-options=foo=bar

I'm not familiar with using the php command, but I guess I can just go back to using composer if I am not able add a few php values to the drush.phar this way. I also need to add open_basedir with an empty value since I need my php.ini to use open_basedir. I'm not sure how this php command is suppose to handle empty values.

Hoping someone has been able to do this.

0

You did it exactly right -- just add the additional Drush command, options and arguments after the part you already typed in. For example:

php -d memory_limit=256M /usr/local/bin/drush --php-options=memory_limit=256M --root=/path --uri=example.com status

That's kind of a lot of typing, so you might want to make an alias:

alias drush='php -d memory_limit=256M /usr/local/bin/drush --php-options=memory_limit=256M'

Then:

drush --root=/path --uri=example.com status

| improve this answer | |
  • Thanks. I think I am getting somewhere now. Interesting. Does this mean that the command isn't permanent and has to be repeated every time? If that's true, would I need to add mulitple php options to the alias? Like for open_basedir, error_reporting, display_errors, etc...? – zerorez Aug 31 '16 at 23:36
  • To make your alias files persistent, add them to a .bashrc file. (See: google.com/search?q=bashrc) If you have a lot of options to set, using -d would make your commandline very long. It would be better to use php -c /path/to/php.ini if you are setting more than one value. – greg_1_anderson Sep 1 '16 at 14:06
  • Looks like it is working so far. Added: alias drush='php -c /etc/drush/php.ini' to .bashrc. Then: $ source .bashrc – zerorez Sep 2 '16 at 17:39
  • Then: [public_html]$ drush --root=/path --uri=example.com status After that the other basic drush commands started working. Thanks again for the tips! – zerorez Sep 2 '16 at 17:48
  • Don't forget to include --php-options='-c /etc/drush/php.ini' in your alias. – greg_1_anderson Sep 2 '16 at 21:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.