By zerorez


2016-08-30 02:28:57 8 Comments

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.

1 comments

@greg_1_anderson 2016-08-30 03:30:38

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

@zerorez 2016-08-31 23:36:01

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

@greg_1_anderson 2016-09-01 14:06:03

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.

@zerorez 2016-09-02 17:39:53

Looks like it is working so far. Added: alias drush='php -c /etc/drush/php.ini' to .bashrc. Then: $ source .bashrc

@zerorez 2016-09-02 17:48:51

Then: [public_html]$ drush --root=/path --uri=example.com status After that the other basic drush commands started working. Thanks again for the tips!

@greg_1_anderson 2016-09-02 21:48:25

Don't forget to include --php-options='-c /etc/drush/php.ini' in your alias.

@zerorez 2016-09-03 00:45:30

OK. Drush had already started functioning without any warnings, but I changed the alias to this: alias drush="php -c /etc/drush/php.ini --php-options='-c /etc/drush/php.ini'"

@greg_1_anderson 2016-09-03 05:02:24

alias drush="php -c /etc/drush/php.ini /usr/local/bin/drush --php-options='-c /etc/drush/php.ini'"

Related Questions

Sponsored Content

1 Answered Questions

[SOLVED] Drush installed in local directory but command not found?

  • 2018-06-24 19:43:08
  • BMcCarrie
  • 1834 View
  • 0 Score
  • 1 Answer
  • Tags:   drush

2 Answered Questions

[SOLVED] Drush php-script | Drupal functions such as node_load() are not being found

  • 2014-06-28 07:51:17
  • Francisco Luz
  • 1177 View
  • 1 Score
  • 2 Answer
  • Tags:   drush

2 Answered Questions

[SOLVED] Could not open input file: drush

  • 2017-07-12 23:23:52
  • Rob Brandt
  • 1486 View
  • 0 Score
  • 2 Answer
  • Tags:   drush installing

1 Answered Questions

[SOLVED] How to get Drush to use alternative php.ini

  • 2016-03-02 21:10:59
  • Joost
  • 826 View
  • 1 Score
  • 1 Answer
  • Tags:   drush

3 Answered Questions

[SOLVED] Undefined error: 0 OR Unable to load autoload.php. Drush now requires Composer

  • 2014-03-06 21:45:22
  • radishred
  • 8528 View
  • 7 Score
  • 3 Answer
  • Tags:   drush composer

6 Answered Questions

[SOLVED] Drush Open_BaseDir Error

  • 2011-09-01 00:52:01
  • Eric I.E.
  • 2438 View
  • 3 Score
  • 6 Answer
  • Tags:   drush

Sponsored Content