我尝试升级 Ubuntu 14.04 LTS 服务器上的 PHP 软件包,但一直出现错误。我知道这个 Qn 有重复,但我从 /var/cache/apt/archives/ 中删除了导致错误的文件,但没有成功。
我运行了以下命令:
sudo apt-add-repository ppa:ondrej/php5
sudo apt-get autoremove
sudo apt-get update
sudo apt-get -f install
然后我得到了这个:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following packages will be REMOVED:
apache2-mpm-prefork apache2.2-bin apache2.2-common php5-dev php5-gd
The following NEW packages will be installed:
apache2-bin apache2-data libjson-c2 php5-json php5-ssh2
The following packages have been kept back:
libgd2-xpm-dev libssl-dev openssl
The following packages will be upgraded:
apache2 libssh2-php php-pear php5 php5-cli php5-common php5-curl php5-fpm php5-mcrypt php5-mysql
10 upgraded, 5 newly installed, 5 to remove and 3 not upgraded.
1 not fully installed or removed.
Need to get 375 kB/8007 kB of archives.
After this operation, 2457 kB disk space will be freed.
Do you want to continue [Y/n]? y
Get:1 http://ppa.launchpad.net/ondrej/php5/ubuntu/ precise/main php-pear all 5.5.30+dfsg-1+deb.sury.org~precise+1 [373 kB]
Get:2 http://ppa.launchpad.net/ondrej/php5/ubuntu/ precise/main php5 all 5.5.30+dfsg-1+deb.sury.org~precise+1 [1220 B]
Fetched 375 kB in 0s (1074 kB/s)
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = "en_US:en",
LC_ALL = (unset),
LC_CTYPE = "UTF-8",
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
(Reading database ... 96522 files and directories currently installed.)
Unpacking apache2-bin (from .../apache2-bin_2.4.16-4+deb.sury.org~precise+4_amd64.deb) ...
dpkg: error processing /var/cache/apt/archives/apache2-bin_2.4.16-4+deb.sury.org~precise+4_amd64.deb (--unpack):
trying to overwrite '/usr/share/man/man8/apache2.8.gz', which is also in package apache2.2-common 2.2.22-1ubuntu1.10
dpkg-deb (subprocess): subprocess data was killed by signal (Broken pipe)
dpkg-deb: error: subprocess <decompress> returned error exit status 2
Processing triggers for man-db ...
Errors were encountered while processing:
/var/cache/apt/archives/apache2-bin_2.4.16-4+deb.sury.org~precise+4_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
答案1
首先你必须删除包apache2.2-common
sudo apt-get remove apache2.2-common
在使用 PPA 之前,可能还需要其他一些步骤ppa:ondrej/php5
。
如果您看到如下错误消息
trying to overwrite '/usr/share/man/man8/apache2.8.gz', which is also in package apache2.2-common 2.2.22-1ubuntu1.10
which is also in package
删除名称介于和 版本之间的软件包,例如2.2.22-1ubuntu1.10
。