I currently have a Debian 9 system, with a LAMP stack installed from the official repositories (Apache 2.4.25, PHP 7.0.33, MariaDB 10.1.38)
I need to install PHP 7.3 because an application needs it. So I followed this tutorial which basically consists of adding a Stretch repository which contains packages for PHP 7.3.
However, when running apt install php7.3
, I get the following:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
php7.3 : Depends: libapache2-mod-php7.3 but it is not going to be installed or
php7.3-fpm but it is not going to be installed or
php7.3-cgi but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
If I try to run apt install libapache2-mod-php7.3
, I am getting:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
libapache2-mod-php7.3 : Depends: php7.3-cli but it is not going to be installed
Depends: libpcre2-8-0 (>= 10.32) but 10.22-3 is to be installed
E: Unable to correct problems, you have held broken packages.
At this point, I guess it's better to not try to forcefully install the packages - if there was not any problem, the install would run smoothly.
I tried to uninstall my current version of PHP and Apache, using aptitude, but nothing seems to really help me on that. However, when I do this tutorial on a fresh install and run the commands above, everything looks to work fine.
However, it's far from being the first time I get this error; I encountered it a lot when trying to install older versions of some packages, and I have been forced to find workarounds like reinstalling a whole older system.
So this makes me think I'm not understanding things about how APT works. I have never "held" packages like the message suggests, so what is exactly causing this error? Is this because some dependencies are missing from all the repositories? Or because some packages are in conflict with each other? As all the packages are tagged with their version, can't just they be installed aside from older/newer versions?