当我尝试在 TurnKey LAMP 设备上安装适用于 PHP 的 GD 库时,收到以下消息:
root@lamp ~# apt-get install php5-gd
Reading package lists... Done
Building dependency tree
Reading state information... Done
php5-gd is already the newest version.
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
php5-gd : Depends: libgd2-xpm (>= 2.0.36~rc1~dfsg) but it is not going to be installed
Depends: libjpeg8 (>= 8c) but it is not going to be installed
Depends: libpng12-0 (>= 1.2.13-4) but it is not going to be installed
Depends: libx11-6 but it is not going to be installed
Depends: libxpm4 but it is not going to be installed
Depends: phpapi-20100525+lfs but it is not installable
Depends: php5-common (= 5.4.4-14) but 5.3.3-7+squeeze14 is to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
然后,当我尝试使用“apt-get -f install”选项时,我得到了这个:
root@lamp ~# apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following extra packages will be installed:
fontconfig-config libfontconfig1 libgd2-xpm libjpeg62 libpng12-0 libx11-6
libx11-data libxau6 libxcb1 libxdmcp6 libxpm4 ttf-dejavu-core
Suggested packages:
libgd-tools
The following packages will be REMOVED:
php5-gd
The following NEW packages will be installed:
fontconfig-config libfontconfig1 libgd2-xpm libjpeg62 libpng12-0 libx11-6
libx11-data libxau6 libxcb1 libxdmcp6 libxpm4 ttf-dejavu-core
0 upgraded, 12 newly installed, 1 to remove and 33 not upgraded.
Need to get 0 B/3557 kB of archives.
After this operation, 8569 kB of additional disk space will be used.
Do you want to continue [Y/n]? Y
[master e6f9b93] saving uncommitted changes in /etc prior to apt run
Author: root <root@lamp>
1 files changed, 1 insertions(+), 1 deletions(-)
rewrite webmin/system-status/info (100%)
debconf: delaying package configuration, since apt-utils is not installed
(Reading database ... 25484 files and directories currently installed.)
Removing php5-gd ...
/var/lib/dpkg/info/php5-gd.prerm: 11: php5dismod: not found
dpkg: error processing php5-gd (--remove):
subprocess installed pre-removal script returned error exit status 127
configured to not write apport reports
Processing triggers for libapache2-mod-php5 ...
Reloading web server config: apache2apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
.
Errors were encountered while processing:
php5-gd
Counting objects: 1469, done.
Compressing objects: 100% (957/957), done.
Writing objects: 100% (1469/1469), done.
Total 1469 (delta 123), reused 1460 (delta 119)
E: Sub-process /usr/bin/dpkg returned an error code (1)
有什么想法吗?谢谢。
答案1
看起来您的基于 Debian 的系统缺少一些使用来自第三方存储库的第三方软件包安装的文件,并且很多东西不同步。
您当前面临的问题是:
/var/lib/dpkg/info/php5-gd.prerm: 11: php5dismod: not found
你可以解决这个问题通过编辑文件/var/lib/dpkg/info/php5-gd.prerm
,删除其全部内容并将其替换为:
#!/bin/sh
set -e
此时,apt-get install -f
再次运行。
成功完成后,要使系统重新同步,请运行:
apt-get update && apt-get dist-upgrade
一旦成功完成,您可以重新安装 php5-gd 包。
apt-get install php5-gd
将来,请小心手动删除系统包中包含的文件,请小心使用第三方存储库,并且如果混合使用不同 Debian 版本(例如稳定版和测试版)的包,请特别小心。