如何在 Debian 9
中安装php5.6
以下软件包具有未满足的依赖项:libapache2-mod-php5: 取决于:libdb5.1但它不可安装取决于:libonig2(> = 5.2.0)但它不可安装取决于:libssl1.0.0(> = 1.0.1)但它不可安装取决于:apache2-mpm-prefork但它不是 可安装或apache2-mpm-itk但它不可安装取决于: php5-cli但它不会被安装E:无法纠正 问题,你已经破了包裹。
答案 0 :(得分:80)
您可以使用OndřejSurý发布的软件包,请参阅deb.sury.org
打开终端并运行以下命令:
apt-get install apt-transport-https lsb-release ca-certificates
获取gpg密钥:
wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
或:
curl https://packages.sury.org/php/apt.gpg | apt-key add -
将新存储库添加到源:
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list
安装PHP5.6
apt-get update
apt-get install php5.6
在PHP版本之间切换:
update-alternatives --config php
示例输出:
----------------------------------------------------------
* 0 /usr/bin/php7.0 70 mode automatique
1 /usr/bin/php5.6 56 mode manuel
2 /usr/bin/php7.0 70 mode manuel
答案 1 :(得分:1)
sudo apt update
sudo apt upgrade
sudo apt install ca-certificates apt-transport-https
wget -q https://packages.sury.org/php/apt.gpg -O- | sudo apt-key add -
echo "deb https://packages.sury.org/php/ stretch main" | sudo tee /etc/apt/sources.list.d/php.list
sudo apt update
sudo apt install php5.6
sudo apt install php5.6-cli php5.6-common php5.6-curl php5.6-mbstring php5.6-mysqlnd php5.6-xml