Skip to main content
2 of 4
added 673 characters in body
philipp
  • 211
  • 3
  • 13

Drush–alias 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 cloned the repo from github, such that I can use drush with the php version from the alias like so:

php7 ./path/to/drush

But doing so just prints the content of drushto the terminal.

How can I setup an alias like the one for php7, that I can run

$drush

from anywhere on that server?

UPDATE

I have added those lines to my .bash_profile

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

Results in:

$drush --version
    Drush Version   :  8.1.7 


$cd /drupal/root
$drush pm-update drupal

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

Any Idea? Why? How can I fix that?

philipp
  • 211
  • 3
  • 13