Ubuntu 12.04 + PHP 5.6 + Memcached =如何解决依赖关系?

时间:2015-05-27 12:26:32

标签: php ubuntu memcached ubuntu-12.04

简单的问题。

我正在尝试在ubuntu上安装php + memcached。

首先,我这样做:

$ sudo add-apt-repository ppa:ondrej/php5-5.6 # Good
$ sudo apt-get update                         # Good
$ sudo apt-get upgrade -y                     # Good
$ sudo apt-get install php5 -y                # Good
$ sudo apt-get install php5-fpm -y            # Good

但是:

$ sudo apt-get install php5-memcached -y
Reading package lists... Done
Building dependency tree
Reading state information... Done
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 created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 php5-memcached : Depends: php5-common (= 5.3.29-1~dotdeb.0) but 5.6.9+dfsg-1+deb.sury.org~precise+2 is to be installed
E: Unable to correct problems, you have held broken packages.

有关服务器的一些信息:

$ cat /etc/*-release | grep PRETTY
PRETTY_NAME="Ubuntu precise (12.04.5 LTS)"

$ php -v | grep PHP
PHP 5.6.9-1+deb.sury.org~precise+2 (cli) (built: May 26 2015 15:13:29)

$ php5-fpm -v | grep PHP
PHP 5.6.9-1+deb.sury.org~precise+2 (fpm-fcgi) (built: May 26 2015 15:38:14)

$ apt-cache policy php5-common
php5-common:
  Installed: 5.6.9+dfsg-1+deb.sury.org~precise+2

如何解决此问题并在5.6上安装memcached扩展?

我也尝试从PECL安装,但是

$ pecl install memcache
pecl/memcache is already installed and is the same as the released version 2.2.7
install failed

谢谢!

1 个答案:

答案 0 :(得分:0)

我已经用OndřejSurýrepo和aptitude解决了这个问题。 我有PHP 5.5.9(Ubuntu 14.04)。这是消息

  

以下软件包具有未满足的依赖项:    php5-memcached:取决于:php5-common(= 5.3.29-1~dotdeb.0)但是要安装5.5.9 + dfsg-1ubuntu4.9

我添加了Ondrej repo:

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

然后安装php5-memcache和php5-memcached:

sudo aptitude install php5-memcached

并按“n”几次,当aptitude提供旧的PHP版本。经过约5次才得以说:

Next actions will solved depends:

 Install next packets:             
1)     php5-memcached [2.1.0-6build1 (trusty)]
Accept this solution? [Y/n/q/?]

按Y.