0

Recently I upgrade my Ubuntu from 20.04 to 22.04. I was using Php7.4 in Ubuntu 20.04 with the Apache server. After upgrading to Ubuntu 22.04, the Php Upgrades to 8.1 automatically. After that, I install Php7.4 also in my system. I can switch PHP version by using this command:

sudo update-alternatives --config php

If I use terminal I can see different PHP versions using php -v. But I am unable to use Php7.4 in apache. I am trying to install using this command:

sudo apt-get install libapache2-mod-php7.4

But it's giving me the following error:

Reading package lists... Done
Building dependency tree... Done
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.4 : Depends: php8.1-common (= 8.1.2-1ubuntu2) but 8.1.5-1+ubuntu22.04.1+deb.sury.org+1.1 is to be installed E: Unable to correct problems, you have held broken packages.

Again if I try to activate Php7.4 in apache using this command:

sudo a2enmod php7.4

I am getting this error:

ERROR: Module php7.4 does not exist!

Now how can I use Php7.4 in my Apache? Note, that Apache was installed in Ubuntu 20.04.

guiverc
  • 30,396
  • @guiverc thank you very much for the answer, I was using Ubuntu 20.10 and upgraded to 22.04 – Md Sadequr Rahman Apr 29 '22 at 13:32
  • You should correct your question then, as the year format products (eg. Ubuntu Core 20) are different to the year.month products (eg. Ubuntu 20.04 LTS). Ubuntu 20.10 was QA-tested & is supported to upgrade only to Ubuntu 21.04 or the next release, so did you re-install? – guiverc Apr 29 '22 at 23:26
  • Hi, this link helped me, In the "Application & Update" panel "For other packages, subscribe to:" I changed it from "all updates" to "only security patches/updates"- and when I changed it back to "all updates"- I could finally install everything. Then I did sudo a2dismod php8.1 then sudo a2enmod php7.4 after that restart apache2. And resolve the issue. – Md Sadequr Rahman Apr 30 '22 at 15:41

0 Answers0