php 在 Debian 9 中安装 php5.6

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/46378017/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 03:13:08  来源:igfitidea点击:

Install php5.6 in Debian 9

phpdebianphp-5.6

提问by karthikeyan

How to install php5.6in the Debian 9

如何php5.6Debian 9 中安装

The following packages have unmet dependencies: libapache2-mod-php5 : Depends: libdb5.1 but it is not installable Depends: libonig2 (>= 5.2.0) but it is not installable Depends: libssl1.0.0 (>= 1.0.1) but it is not installable Depends: apache2-mpm-prefork but it is not installable or apache2-mpm-itk but it is not installable Depends: php5-cli but it is not going to be installed E: Unable to correct problems, you have held broken packages.

以下软件包具有未满足的依赖项: libapache2-mod-php5 : 依赖项: libdb5.1 但不可安装 依赖项: libonig2 (>= 5.2.0) 但不可安装 依赖项: libssl1.0.0 (>= 1.0.1)但它不可安装 依赖:apache2-mpm-prefork 但它不可安装或 apache2-mpm-itk 但它不可安装 依赖:php5-cli 但它不会被安装 E:无法纠正问题,你有拿着破损的包裹。

回答by GAD3R

You can use the packages released by Ond?ej Sury , see deb.sury.org

您可以使用 Ond?ej Sury 发布的软件包,请参阅deb.sury.org

Open the terminal and run the following command:

打开终端并运行以下命令:

apt-get install apt-transport-https lsb-release ca-certificates

Get the gpg key:

获取 gpg 密钥:

wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg

or:

或者:

curl https://packages.sury.org/php/apt.gpg | apt-key add -

Add the new repository to your sources:

将新存储库添加到您的源:

echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list

Install PHP5.6

安装 PHP5.6

apt-get update
apt-get install php5.6

To switch between PHP versions:

要在 PHP 版本之间切换:

update-alternatives --config php

Sample output:

示例输出:

----------------------------------------------------------
* 0            /usr/bin/php7.0   70        mode automatique
  1            /usr/bin/php5.6   56        mode manuel
  2            /usr/bin/php7.0   70        mode manuel

回答by iCODEiT

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