I just installed php-mysql on Ubuntu 18:

apt install php-mysql

After that I noticed two new packages when running apt list --installed:

php-mysql/bionic,bionic,now 1:7.2+60ubuntu1 all [installed]
php7.2-mysql/bionic-updates,bionic-security,now 7.2.24-0ubuntu0.18.04.6 amd64 [installed,automatic]

I would expect only one new package. Why two packages where the only difference is the version number in the package name?


It's for your convenience :)

The package php-mysql is called a "dependency package". It will depend on Ubuntu's default PHP version (currently 7.2). Whenever Ubuntu decides that 7.3 is stable enough, the dependency packages will change dependencies, and everyone will get the 7.3 version installed.

(Text partially taken from the output of apt-cache show php-mysql.)

  • So at some point 7.3 will be the default, and then apt install php-mysql would give me the 7.3 version, regardless which version is in use on the server? ... and I would then have to do apt install php7.2-mysql to get the 7.2 instead of 7.3? – Jette Aug 10 '20 at 13:11
  • 1
    If you want to use a specific version, I'd suggest you do apt install php7.2-mysql directly. Only if you want to "keep up" with whatever Ubuntu thinks is okay, you should do apt install php-mysql. In the first case, whenever you update your system (apt update ; apt upgrade) you will only get 7.2.x versions. In the latter case, you could get either 7.2.1, 7.3.1, 8.0.0, etc. – Jurrie Aug 10 '20 at 13:40
  • Thank you! That was very helpful :-D – Jette Aug 10 '20 at 13:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.