Debian
無法安裝 php5-mysql 或 php5-mysqlnd
我在 docker container 中使用 Debian Jessie
docker run --entrypoint /bin/bash -i -t php:5-apache
。不幸的是,我無法安裝 php5-mysql 或 php5-mysqlnd 。我做了以下步驟:
apt-get update
Hit http://security.debian.org jessie/updates InRelease Get:1 http://security.debian.org jessie/updates/main amd64 Packages [641 kB] Ign http://deb.debian.org jessie InRelease Hit http://deb.debian.org jessie-updates InRelease Hit http://deb.debian.org jessie Release.gpg Get:2 http://deb.debian.org jessie-updates/main amd64 Packages [23.1 kB] Hit http://deb.debian.org jessie Release Get:3 http://deb.debian.org jessie/main amd64 Packages [9064 kB] Fetched 9728 kB in 45s (215 kB/s) Reading package lists... Done
apt-get install php5-mysql
Reading package lists... Done Building dependency tree Reading state information... Done Package php5-mysql is a virtual package provided by: php5-mysqlnd 5.6.33+dfsg-0+deb8u1 [Not candidate version] php5-mysqlnd 5.6.30+dfsg-0+deb8u1 [Not candidate version] E: Package 'php5-mysql' has no installation candidate
apt-get install php5-mysqlnd
Reading package lists... Done Building dependency tree Reading state information... Done Package php5-mysqlnd 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 However the following packages replace it: php5-mysql E: Package 'php5-mysqlnd' has no installation candidate
我錯過了什麼?
邁克爾
如果您使用的是Docker PHP5-apache 映像,那麼所描述的行為很可能是由 APT 首選項文件 /etc/apt/preferences.d/no-debian-php 引起的。其中的內容似乎阻止了 APT 考慮任何與 PHP 相關的包。
您正在使用的 docker 映像提供了一個源建構的 PHP,APT PHP 包在這裡不會幫助您。如果您需要為 docker 鏡像中安裝的 PHP 添加擴展,您應該使用文件中描述的幫助腳本從原始碼建構。