Debian

安裝php7.1-gd的問題

  • February 11, 2022

我在 debian9 上執行並使用ppa:ondrej/php儲存庫,但無法安裝 php7.1。也不安裝缺少的依賴項。當我嘗試安裝它時,apt install php7.1-gd我遇到了這個錯誤。

apt-get install php7.1-gd
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
php7.1-gd : Depends: libgd3 (>= 2.1.1) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

這是我嘗試安裝時發生的錯誤libgd3

apt install libgd3
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
libgd3 : Depends: libc6 (>= 2.29) but 2.24-11+deb9u4 is to be installed
         Depends: libfontconfig1 (>= 2.12.6) but 2.11.0-6.7+b1 is to be installed
         Depends: libjpeg8 (>= 8c) but it is not installable
E: Unable to correct problems, you have held broken packages.

不要在 Debian 9 上使用 PPA,請使用適當的儲存庫,如OndrejREADME.txt中所述:

sudo apt-get -y install apt-transport-https lsb-release ca-certificates
sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
sudo sh -c 'echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'
sudo apt-get update

這將允許您安裝php7.1-gdDebian 9 中可以滿足的依賴項。

你可以從這裡找到包:

http://ftp.br.debian.org/debian/pool/main/libj/libjpeg-turbo

wget http://ftp.br.debian.org/debian/pool/main/libj/libjpeg-turbo/libjpeg62-turbo_1.5.1-2_amd64.deb
dpkg -i libjpeg62-turbo_1.5.1-2_amd64.deb

引用自:https://unix.stackexchange.com/questions/511933