Which alias do I use to run it with another PHP version? The Server available for our new Drupal project uses an old PHP CLI Version by default. But I have setup an alias in .bash_profile like so:

alias php7=/path/to/php7


and that is working fine. I would like to use Drush, so I cloned the repository, such that I can use Drush with the PHP version from the alias with php7 ./path/to/drush.

Doing so just prints the content of Drush to the terminal.

How can I setup an alias for PHP 7 that allows me to run Drush with that PHP version?

I have added these lines to the .bash_profile file.

alias php7=/path/to/php7
export DRUSH_PHP=/path/to/php7
alias drush="php7 $HOME/path/to/drush.phar"


When I run drush pm-update drupal, I get the following errors.


  The external command could not be executed due to an application error.
  The command could not be executed successfully
  Returned: PHP Parse error:  syntax error, unexpected '[' in    phar:///path/to/drush.phar/includes/startup.inc on line 63, code: 255)
  pm-updatestatus failed.


Why? How can I fix that?

Running drush pm-updatestatus or drush cr works, and drush status shows no errors.

Is there a bug in a specific version?
This is possible by setting the environment variable DRUSH_PHP as described in the documentation.
https://www.drupal.org/node/1302418

Also you can make use of "php" global otpion which allows to specify the absolute path to PHP interpreter.