我正在维护3个都运行Ubuntu 16.04的Web服务器。目前,我们正在尝试从php-memcache迁移到php-memcached,然后再将服务器升级到18.04,甚至可能是20.04。
我已经在3个Web服务器中的1个上成功安装了php-memcached,但是另外两个给我一个依赖错误。
# apt-get install php-memcached
[...]
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 create or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
php-memcached: Depends: php-common (>= 1:7.0+33~) but it is not going to be installed
Depends: phpapi-20151012
E: Unable to correct problems, you have held broken packages.
尝试了更新-> dist-upgrade并重新启动,但这并没有解决问题。
这些是根据以下内容的存储库apt-get update
:
# apt-get update
Get:1 http://security.ubuntu.com/ubuntu xenial-security InRelease [109 kB]
Hit:2 http://us.archive.ubuntu.com/ubuntu xenial InRelease
Get:3 http://us.archive.ubuntu.com/ubuntu xenial-updates InRelease [109 kB]
Get:4 http://us.archive.ubuntu.com/ubuntu xenial-backports InRelease [107 kB]
Fetched 325 kB in 0s (364 kB/s)
看来麻烦在于phpapi-20151012
# apt-get -o Debug::pkgProblemResolver=yes install phpapi-20151012
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package phpapi-20151012 is a virtual package provided by:
php7.0-phpdbg 7.0.33-0ubuntu0.16.04.15
php7.0-fpm 7.0.33-0ubuntu0.16.04.15
libphp7.0-embed 7.0.33-0ubuntu0.16.04.15
php7.0-cli 7.0.33-0ubuntu0.16.04.15
php7.0-cgi 7.0.33-0ubuntu0.16.04.15
libapache2-mod-php7.0 7.0.33-0ubuntu0.16.04.15
You should explicitly select one to install.
E: Package 'phpapi-20151012' has no installation candidate
据我了解,以上消息phpapi-20151012应该与所列软件包之一一起提供。我已经安装了其中的2个,但仍然没有phpapi。所以我尝试安装一个我没有的东西,但是那也不起作用。
似乎php-common包还可以:
# apt-get -o Debug::pkgProblemResolver=yes install php-common
Reading package lists... Done
Building dependency tree
Reading state information... Done
php-common is already the newest version (1:62+ubuntu14.04.1+deb.sury.org+1).
Starting pkgProblemResolver with broken count: 0
Starting 2 pkgProblemResolver with broken count: 0
Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
我还注意到php 7.1软件包似乎是Ubuntu 14的遗留物:
php7.1-cli/now 7.1.19-1+ubuntu14.04.1+deb.sury.org+1 amd64 [installed,local]
php7.1-common/now 7.1.19-1+ubuntu14.04.1+deb.sury.org+1 amd64 [installed,local]
php7.1-json/now 7.1.19-1+ubuntu14.04.1+deb.sury.org+1 amd64 [installed,local]
php7.1-opcache/now 7.1.19-1+ubuntu14.04.1+deb.sury.org+1 amd64 [installed,local]
php7.1-readline/now 7.1.19-1+ubuntu14.04.1+deb.sury.org+1 amd64 [installed,local]
Apache使用的是php 7.0,而cli使用的是7.1 ...因此,作为开始,我已经将php cli降级为7.0:
# update-alternatives --config php
There are 3 choices for the alternative php (providing /usr/bin/php).
Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/bin/php7.1 71 auto mode
1 /usr/bin/php5.6 56 manual mode
2 /usr/bin/php7.0 70 manual mode
3 /usr/bin/php7.1 71 manual mode
Press <enter> to keep the current choice[*], or type selection number: 2
# update-alternatives --config php
There are 3 choices for the alternative php (providing /usr/bin/php).
Selection Path Priority Status
------------------------------------------------------------
0 /usr/bin/php7.1 71 auto mode
1 /usr/bin/php5.6 56 manual mode
* 2 /usr/bin/php7.0 70 manual mode
3 /usr/bin/php7.1 71 manual mode
Press <enter> to keep the current choice[*], or type selection number:
接下来,我删除了7.1软件包:
apt-get remove php7.1-cli
apt-get autoremove
之后,所有的php7.1软件包都消失了
然后尝试这个:
apt-get update --fix-missing
Get:1 http://security.ubuntu.com/ubuntu xenial-security InRelease [109 kB]
Hit:2 http://us.archive.ubuntu.com/ubuntu xenial InRelease
Get:3 http://us.archive.ubuntu.com/ubuntu xenial-updates InRelease [109 kB]
Get:4 http://us.archive.ubuntu.com/ubuntu xenial-backports InRelease [107 kB]
Get:5 http://us.archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages [802 kB]
Get:6 http://us.archive.ubuntu.com/ubuntu xenial-updates/universe i386 Packages [723 kB]
Fetched 1,850 kB in 1s (1,091 kB/s)
Reading package lists... Done
# apt-get install -f
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
还是没有运气...我不知道。有什么建议么?
更新:
根据评论中的要求:
# apt policy php-common
php-common:
Installed: 1:62+ubuntu14.04.1+deb.sury.org+1
Candidate: 1:62+ubuntu14.04.1+deb.sury.org+1
Version table:
*** 1:62+ubuntu14.04.1+deb.sury.org+1 100
100 /var/lib/dpkg/status
1:35ubuntu6.1 500
500 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages
500 http://us.archive.ubuntu.com/ubuntu xenial-updates/main i386 Packages
1:35ubuntu6 500
500 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 Packages
500 http://us.archive.ubuntu.com/ubuntu xenial/main i386 Packages
500 http://archive.ubuntu.com/ubuntu xenial/main amd64 Packages
500 http://archive.ubuntu.com/ubuntu xenial/main i386 Packages
仍然至少有一个PHP 7.1软件包的剩余部分php-common
;您需要将其降级到Ubuntu存储库中可用的版本:
apt install php-common=1:35ubuntu6.1
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句