How can I install a package with specific PHP versions if the package itself does not contrain it?

Ask Ubuntu Asked on January 3, 2022

My package does not define specific PHP version in its dependency, but only works with older PHP versions (7.2). On Ubuntu 20.04 the apt install <my-package> will want to install php7.4-mysql, unless I explicitelly install php7.2-mysql.

Is there a solution to configure PHP (repositories, versions) and/or apt in a way that apt install <my-package> can only install its dependency for specific PHP versions?

One Answer

If the repository contains more than on version it is possible to install that certain version with:

sudo apt install <my-package>=<X.Y> e.g.

sudo apt install php=7.2

but the chances are low that there are more versions of php. (They must be compiled against the current libraries, so maintenance of different versions costs quite some time)

You could add a ppa which is compatible with 20.04, or you can download the appropriate deb files.

Those files can be installed either with the gdebi installer (GUI frontend( or by hand: `sudo dpkg -i <name-of-debfile.deb>

Answered by kanehekili on January 3, 2022

Add your own answers!

Ask a Question

Get help from others!

© 2024 All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP