如何使用 PHP 5.5 在 Debian 7 上安装 php5-memcached?

如何使用 PHP 5.5 在 Debian 7 上安装 php5-memcached?

我尝试在 Debian 7 VirtualBox VM 上安装 PHP 5 Memcached 模块失败:

root@testvm:~# apt-get install php5-memcached
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: libmemcached11 but it is not installable
E: Unable to correct problems, you have held broken packages.

我也无法通过 Synaptic Package Manager 安装它。

我想,问题可能在于缺少源信息/etc/apt/sources.list


更新:

/etc/apt/sources.list

# deb cdrom:[Debian GNU/Linux 7.1.0 _Wheezy_ - Official amd64 NETINST Binary-1 20130615-23:04]/ wheezy main

# deb cdrom:[Debian GNU/Linux 7.1.0 _Wheezy_ - Official amd64 NETINST Binary-1 20130615-23:04]/ wheezy main

deb http://ftp.de.debian.org/debian/ wheezy main contrib non-free
deb-src http://ftp.de.debian.org/debian/ wheezy main contrib non-free

deb http://security.debian.org/ wheezy/updates main contrib non-free
deb-src http://security.debian.org/ wheezy/updates main contrib non-free

# wheezy-updates, previously known as 'volatile'
deb http://ftp.de.debian.org/debian/ wheezy-updates main contrib non-free
deb-src http://ftp.de.debian.org/debian/ wheezy-updates main contrib non-free

# nginx
deb http://packages.dotdeb.org wheezy all
deb-src http://packages.dotdeb.org wheezy all

# PHP 5.5
deb http://packages.dotdeb.org wheezy-php55 all
deb-src http://packages.dotdeb.org wheezy-php55 all

更新:

我尝试手动安装缺少的依赖项,但它也不起作用:

root@devvm:~# apt-get install libmemcached11
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package libmemcached11 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'libmemcached11' has no installation candidate

更新:

root@devvm:~# apt-cache depends php5-memcached libmemcached10
php5-memcached
  Depends: libc6
  Depends: <libmemcached11>
  Depends: zlib1g
  Depends: <phpapi-20121212>
    libapache2-mod-php5filter
    libapache2-mod-php5
    libphp5-embed
    php5-cgi
    php5-cli
    php5-fpm
  Depends: php5-common
 |PreDepends: dpkg
  PreDepends: <dpkg-maintscript-helper>
libmemcached10
  Depends: libc6
  Depends: libgcc1
  Depends: libstdc++6
  PreDepends: multiarch-support
  Conflicts: <libmemcached2>
  Conflicts: <libmemcached3>
  Conflicts: <libmemcached6>
  Conflicts: <libmemcached9>

答案1

要解决您的问题,您只需将以下内容添加到您的sources.list中:

# Wheezy
deb http://ftp.hosteurope.de/mirror/packages.dotdeb.org/ wheezy all
deb-src http://ftp.hosteurope.de/mirror/packages.dotdeb.org/ wheezy all

# Wheezy-php55
deb http://ftp.hosteurope.de/mirror/packages.dotdeb.org/ wheezy-php55 all
deb-src http://ftp.hosteurope.de/mirror/packages.dotdeb.org/ wheezy-php55 all

事实上,缺少的依赖项(libmemcached11)存在于气喘吁吁的分布点德布存储库。

答案2

尝试使用发布标签

由于您的存储库不是 Debian,因此让我们从您想要包的位置指定 apt-get。尝试使用:

sudo apt-get -t stable install php5-memcached

这将解决您的依赖性问题,因为它将从稳定的存储库php5-memcached安装。libmemcached10

固定方式

由于apt-get -t stable将 dotdeb.org 作为软件包的最新稳定版本,因此要么禁用镜像,apt-get update然后安装软件包,要么使用固定魔法。创建包含以下内容的文件/etc/apt/preferences.d/aptpinning

Package: php5-memcached
Pin: origin "ftp.de.debian.org"
Pin-Priority: 990

Package: php5-memcached
Pin: origin "packages.dotdeb.org"
Pin-Priority: 500

这将使ftp.de.debian.org来自 的包的优先级高于来自 的包packages.dotdeb.org

再次,混合回购是个坏主意,因为这种情况可能(并且已经)发生。除非是很关键的事情,否则您不应该混合使用可能导致依赖关系损坏的存储库。

也许您需要向后移植存储库

如果您使用其他来源的 PHP 的原因是“安全”,那么您最好使用 wheezy-backport 存储库。只需添加deb http://YOURMIRROR.debian.org/debian wheezy-backports main到您的sources.list、运行apt-get update,然后使用安装包apt-get -t wheezy-backports install "package"。如果您尝试此操作,请恢复使用其他方法所做的任何更改。

答案3

确保你有

deb http://packages.dotdeb.org wheezy all

在你的消息来源中!看PHP 5.5.6,适用于 Debian 7.0“Wheezy”。为我工作。

答案4

我已经安装好了。不知何故...

我尝试安装libmemcached11。由于安装apt-get不起作用,我从源安装了它:

root@devvm:~# wget http://ftp.de.debian.org/debian/pool/main/libm/libmemcached/libmemcached11_1.0.17-2_amd64.deb
...
2013-07-23 22:07:02 (713 KB/s) - `libmemcached11_1.0.17-2_amd64.deb' saved [112238/112238]

root@devvm:~# dpkg --install libmemcached11_1.0.17-2_amd64.deb 
Selecting previously unselected package libmemcached11:amd64.
(Reading database ... 149070 files and directories currently installed.)
Unpacking libmemcached11:amd64 (from libmemcached11_1.0.17-2_amd64.deb) ...
dpkg: dependency problems prevent configuration of libmemcached11:amd64:
 libmemcached11:amd64 depends on libc6 (>= 2.16); however:
  Version of libc6:amd64 on system is 2.13-38.

dpkg: error processing libmemcached11:amd64 (--install):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 libmemcached11:amd64

如您所见,有错误。但现在libmemcached11已经安装了。

因为我认为安装失败了,所以我首先决定删除下载的(损坏的?)包,但中止了该过程,以便尝试使用php5-memcached它进行安装(也许它会起作用......不知何故......):

root@devvm:~# apt-get remove libmemcached11
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
...
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
  libmemcached11
0 upgraded, 0 newly installed, 1 to remove and 3 not upgraded.
1 not fully installed or removed.
After this operation, 261 kB disk space will be freed.
Do you want to continue [Y/n]? n
Abort.

然后我再次尝试安装php5-memcached——这次成功了:

root@devvm:~# apt-get -t stable install php5-memcached
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
...
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  libmemcached11
The following NEW packages will be installed:
  libmemcached11 php5-memcached
0 upgraded, 2 newly installed, 0 to remove and 3 not upgraded.
Need to get 148 kB of archives.
After this operation, 397 kB of additional disk space will be used.
Do you want to continue [Y/n]? Y
Get:1 http://packages.dotdeb.org/ wheezy/all libmemcached11 amd64 1.0.16-1 [113 kB]
Get:2 http://packages.dotdeb.org/ wheezy-php55/all php5-memcached amd64 5.5.0-1~dotdeb.1 [34.9 kB]
Fetched 148 kB in 0s (328 kB/s)      
Selecting previously unselected package libmemcached11:amd64.
(Reading database ... 149070 files and directories currently installed.)
Unpacking libmemcached11:amd64 (from .../libmemcached11_1.0.16-1_amd64.deb) ...
Selecting previously unselected package php5-memcached.
Unpacking php5-memcached (from .../php5-memcached_5.5.0-1~dotdeb.1_amd64.deb) ...
Processing triggers for php5-fpm ...
[ ok ] Restarting PHP5 FastCGI Process Manager: php5-fpm.
Setting up libmemcached11:amd64 (1.0.16-1) ...
Setting up php5-memcached (5.5.0-1~dotdeb.1) ...

Creating config file /etc/php5/mods-available/memcached.ini with new version
Processing triggers for php5-fpm ...
[ ok ] Restarting PHP5 FastCGI Process Manager: php5-fpm.

相关内容