I'm using Debian Jessie inside a docker container docker run --entrypoint /bin/bash -i -t php:5-apache. Unfortunately, I am not able to install php5-mysql or php5-mysqlnd . I did the following steps:

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:

E: Package 'php5-mysqlnd' has no installation candidate

What did I miss?


1 Answer 1


If you are using the Docker PHP5-apache image, then the described behavior is most likely caused by the APT preferences file /etc/apt/preferences.d/no-debian-php. The contents of which appear to prevent APT from considering any PHP related packages.

The docker image you are using provides a source built PHP, the APT PHP packages will not help you here. If you need to add extensions to the PHP installed in the docker image, you are supposed to build from source using the helper scripts described in the documentation.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .