This question already has an answer here:
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?