how to manage multiple php version?

Created at: 2020-04-27 14:28:57 Updated at: 2020-05-26 13:46:25

in Linux

Managing Multiple PHP versions via the ondrej/php PPA

First of remove registered PPA key so it will note make dublication.

sudo add-apt-repository  --remove  ppa:ondrej/php

Secound install/register PPA key so it will note make dublication.

sudo LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php

Easy for every linux

sudo apt -y install lsb-release apt-transport-https ca-certificates 
sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php.list

Third notify the system that new PPA is available for packages.

sudo apt-get update

Last but not least

for VERSION in 7.2 7.4;do
    for EXTENSION in {listed all extensions here};do
        sudo apt install php${VERSION}-${EXTENSION}
    done
done