如何使用 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 包管理器安裝它。
我想,問題可能在於
/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>
要解決您的問題,您只需將以下內容添加到您的 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) 存在於dotdeb儲存庫的****wheezy發行版中。
嘗試使用發布標籤
由於您有非 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
這將使包 from 優先於
ftp.de.debian.org
frompackages.dotdeb.org
。同樣,混合 repos 是個壞主意,因為這種情況可能(並且已經)發生。除非是關鍵的東西,否則您不應該混合可能導致依賴關係中斷的 repos。
也許你需要 backport repo
如果您從其他來源使用 PHP 的原因是關於“安全性”,那麼您最好使用 wheezy-backport 儲存庫。只需添加
deb http://YOURMIRROR.debian.org/debian wheezy-backports main
到您的sources.list
,執行apt-get update
,然後使用apt-get -t wheezy-backports install "package"
. 如果您嘗試這樣做,請恢復使用其他方法的任何更改。