代码之家  ›  专栏  ›  技术社区  ›  Dalia Hassan

在Linode服务器Debian 9上安装php5.6的GD库时出现依赖关系中断

  •  1
  • Dalia Hassan  · 技术社区  · 7 年前

    Linode服务器Debian 9上php5.6的GD库

    我跑步 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。列表

    # 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。列表d/* enter image description here

    2 回复  |  直到 7 年前
        1
  •  1
  •   GAD3R RoseHosting    7 年前

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

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

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

    启用时,依赖性问题来自artuful 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版本之间切换。

        2
  •  1
  •   metamaker    7 年前

    问题是 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
    

    我希望这有帮助。