I have PHP 5.6 and 7.1 on my system. I want to use PHP 5.6 for the Drupal 7 projects, and PHP 7.1 for the Drupal 8 projects.

I am having problems getting this setup. In the documentation I found that I should set an alias like this in my ~/.zshrc.

 alias drush='DRUSH_PHP=/usr/bin/php56 /usr/bin/drush'

The problem is that when I start a new terminal and run drush ev 'print PHP_VERSION', it still prints out 7.1.6.

I tried to alias PHP to /usr/bin/php56 but that also did not work.

I also tried the following suggestions (and many others), but they didn't work.

I think this changed in more recent Drush versions, like version 8.1.12 I am using.

Can anyone help me find the correct way to do this in more modern Drush versions?

  • I managed to put the correct php default in cli by putting it first in my path. I get the correct response now when I do php -v but drush stopped giving any output. – Jarco Jul 14 '17 at 19:53

Did you try in your .profile:

export DRUSH_PHP='usr/bin/php56'

I think you are mixing up alias with setting an environment variable.

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