【问题标题】:Broken dependencies while installing GD Library for php5.6 on Linode server Debian 9在 Linode 服务器 Debian 9 上为 php5.6 安装 GD 库时依赖关系中断
【发布时间】:2018-05-02 16:16:05
【问题描述】:

我想在 Linode Server Debian 9 上安装 GD Library for php5.6

我跑apt-get install php5.6-gd

输出是:

php5.6-gd : Depends: libgd3 (>= 2.1.1) but it is not going to be installed

然后我尝试安装该软件包apt-get install libgd3 输出是:

 libgd3 : Depends: libfontconfig1 (>= 2.11.94) but 2.11.0-6.7+b1 is to be installed
 Depends: libjpeg8 (>= 8c) but it is not installable

我尝试通过运行命令apt-get install libfontconfig1=2.11.94来安装提到的版本

输出是:

Version '2.11.94' for 'libfontconfig1' was not found

我通过运行检查了 libfontconfig1 包的可用版本:

apt-cache policy libfontconfig1

输出是:

libfontconfig1:

 Installed: 2.11.0-6.7+b1
 Candidate: 2.11.0-6.7+b1
 Version table:
2.11.0-6.7+b1 500
       500 http://mirrors.linode.com/debian stretch/main amd64 Packages
       100 /var/lib/dpkg/status

我没有找到可用的 (>= 2.11.94) 版本。

cat /etc/apt/sources.list

的输出
# deb http://mirrors.linode.com/debian/ stretch main

deb http://mirrors.linode.com/debian/ stretch main
deb-src http://mirrors.linode.com/debian/ stretch main

deb http://security.debian.org/debian-security stretch/updates main
deb-src http://security.debian.org/debian-security stretch/updates main

deb http://ftp.de.debian.org/debian stretch main

cat /etc/apt/sources.list.d/*enter image description here的输出

【问题讨论】:

标签: linux debian gd php-5.6 linode


【解决方案1】:

问题是http://ppa.launchpad.net/ondrej/php/ubuntu 包含有冲突的 libgd3 版本。

vagrant@localhost:~$ sudo apt-cache policy libgd3
libgd3:
  Installed: (none)
  Candidate: 2.2.5-3+ubuntu16.04.1+deb.sury.org+1
  Version table:
     2.2.5-3+ubuntu16.04.1+deb.sury.org+1 500
        500 http://ppa.launchpad.net/ondrej/php/ubuntu xenial/main amd64 Packages
     2.2.4-2+deb9u2 500
        500 http://deb.debian.org/debian stretch/main amd64 Packages
        500 http://security.debian.org/debian-security stretch/updates/main amd64 Packages

您需要从官方仓库安装版本,如下所示:

vagrant@localhost:~$ sudo apt-get install libgd3=2.2.4-2+deb9u2

我希望这会有所帮助。

【讨论】:

    【解决方案2】:

    在 debian 拉伸您的 /etc/apt/sources.list.d/php.list 应该只包含以下行:

    deb https://packages.sury.org/php/ stretch main
    

    您需要取消注释以上行(删除 #)并保持其他 ppa 禁用(您不需要它们)。

    启用时的依赖问题来自巧妙的 ppa。要解决您的问题,请打开终端然后运行以下命令:

    rm /etc/apt/sources.list.d/*
    apt install apt-transport-https lsb-release ca-certificates curl
    echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list
    curl https://packages.sury.org/php/apt.gpg | apt-key add -
    apt update
    apt upgrade
    apt dist-upgrade
    apt install php5.6
    

    使用update-alternatives --config php切换php版本。

    【讨论】:

      猜你喜欢
      • 2018-03-04
      • 2012-05-12
      • 1970-01-01
      • 2019-01-04
      • 1970-01-01
      • 1970-01-01
      • 2016-08-16
      • 2019-08-14
      相关资源
      最近更新 更多