将 PHP 从 5.3 升级到 5.6,未满足依赖关系

将 PHP 从 5.3 升级到 5.6,未满足依赖关系

我有一个运行 php 5.3 的 OVH VPS。我想更新到 php 5.6。我使用过这个解决方案 (如何在 Ubuntu 中从 PHP 5.3 升级到 PHP 5.4.6?):

sudo add-apt-repository ppa:ondrej/php5-5.6
sudo apt-get update
sudo apt-get install php5

但我有这个错误:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 libapache2-mod-php5 : Depends: apache2-api-20120211
                       Depends: apache2 (>= 2.4)
                       Depends: php5-common (= 5.6.18+dfsg-1+deb.sury.org~precise+1) but 5.3.10-1ubuntu3.15 is to be installed
 libapache2-mod-wsgi-py3 : Depends: apache2-api-20120211
 php5 : Depends: php5-common (>= 5.6.18+dfsg-1+deb.sury.org~precise+1~) but 5.3.10-1ubuntu3.15 is to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

您能帮我完成以下步骤吗?非常感谢。

编辑

当我运行时,sudo apt-get -f install出现以下错误:

Get:24 http://ppa.launchpad.net/ondrej/php5-5.6/ubuntu/ precise/main pkg-php-tools all 1.21+deb.sury.org~precise+1 [38.7 kB]
Fetched 7,138 kB in 0s (13.8 MB/s)   
(Reading database ... 77021 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.7
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

我认为首先卸载现有的 PHP 应该可以解决这个问题。

$ sudo apt-get remove php5*

相关内容