首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >由于未满足的依赖关系,无法在Ubuntu 16上安装php-memcached

由于未满足的依赖关系,无法在Ubuntu 16上安装php-memcached
EN

Unix & Linux用户
提问于 2020-08-05 07:36:19
回答 1查看 1.1K关注 0票数 1

我正在维护3台网络服务器,全部运行Ubuntu16.04。目前,我们正在尝试从php-memcache迁移到,然后再将服务器升级到18.04,甚至可能是20.04。

我已经成功地在3台are服务器中的1台上安装了php-memcached,但是另外两个服务器给了我一个依赖错误。

代码语言:javascript
复制
# 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.

尝试了update -> dist-升级和重新启动,但这还没有解决问题。

根据apt-get update,这些是存储库:

代码语言:javascript
复制
# 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上。

代码语言:javascript
复制
# 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应该提供其中一个包所列。我已经安装了两台,但还是没有。所以我试着安装一个我没有的,但也没有用。

看来php公共包是可以的:

代码语言:javascript
复制
# 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的剩菜:

代码语言:javascript
复制
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使用php7.0,cli使用7.1 .因此,首先,我将php cli降级为7.0:

代码语言:javascript
复制
# 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包:

代码语言:javascript
复制
apt-get remove php7.1-cli
apt-get autoremove

在那之后,所有php7.1包都不见了

然后尝试了这个:

代码语言:javascript
复制
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.

还是没有运气..。我没有头绪。有什么建议吗?

更新:

按照评论中的要求:

代码语言:javascript
复制
# 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
EN

回答 1

Unix & Linux用户

回答已采纳

发布于 2020-08-05 08:42:38

PHP7.1包至少还有一个残余,即php-common;您需要将其降级为Ubuntu存储库中可用的版本:

代码语言:javascript
复制
apt install php-common=1:35ubuntu6.1
票数 2
EN
页面原文内容由Unix & Linux提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://unix.stackexchange.com/questions/602930

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档