PHP in macOS & Linux Server
If you have MAMP installed, and you want to use it for cli, you can add this to your bash profile
export PATH=/usr/local/bin:$PATH
export PATH=/Applications/MAMP/bin/php/php5.5.10/bin:$PATH
Make sure the order is correct. Put export PATH=/usr/local/bin:$PATH
before export PATH=/Applications/MAMP/bin/php/php5.5.10/bin:$PATH
How to Install Multiple PHP Version with Nginx on Ubuntu 18.04 & 16.04
HowTo: Change the PHP version on Apache or Nginx
update-alternatives --display php
sudo update-alternatives --config php
sudo update-alternatives -set php /usr/bin/php7.2
References:
macos - Mac / OSx - Change PHP version which is call in bash - Stack Overflow
https://stackoverflow.com/questions/13297965/mac-osx-change-php-version-which-is-call-in-bash
HowTo: Change PHP version on Apache & Nginx | OpenSense Labs
https://opensenselabs.com/blog/tech/change-php-version-drupal-website-apache-nginx