ubuntu - php 多版本安装
原文:https://techvblogs.com/blog/install-multiple-php-versions-on-ubuntu-22-04
sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt update
安装php8.1:
sudo apt-get install php8.1 php8.1-fpm
安装php8.1拓展:
sudo apt-get install php8.1-mysql php8.1-mbstring php8.1-xml php8.1-gd php8.1-curl
安装php8.0:
apt-get install php8.0 php8.0-fpm
安装php8.0拓展:
sudo apt-get install php8.0-mysql php8.0-mbstring php8.0-xml php8.0-gd php8.0-curl
查看当前版本:
php -v
切换版本:
update-alternatives --config php
卸载:
sudo apt-get remove php8.1
sudo apt-get remove php8.1-*