Developers Notes

My Journey as Software Architect

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

sudo apt install python-software-properties
sudo add-apt-repository ppa:ondrej/php
apt update
sudo apt install php5.6 php5.6-fpm
sudo apt install php7.2 php7.2-fpm
sudo systemctl status php5.6-fpm
sudo systemctl status php7.2-fpm

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