sudo apt update
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install -y php7.2
sudo apt install -y php7.2-cli php7.2-curl php7.2-common php7.2-mbstring php7.2-intl php7.2-xml php7.2-mysql php7.2-bz2 php7.2-gd
切换:
sudo update-alternatives --config php