无法安装 php5-mysql 或 php5-mysqlnd

无法安装 php5-mysql 或 php5-mysqlnd

我在 docker 容器中使用 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

我错过了什么?

米哈尔

答案1

如果您正在使用Docker PHP5-apache 镜像,那么所描述的行为很可能是由 APT 首选项文件 /etc/apt/preferences.d/no-debian-php 引起的。其中的内容似乎阻止 APT 考虑任何 PHP 相关包。

您正在使用的 docker 映像提供了构建 PHP 的源代码,APT PHP 软件包在这里无法为您提供帮助。如果您需要向 docker 映像中安装的 PHP 添加扩展,则应该使用所述的帮助程序脚本从源代码构建在文档中

相关内容