Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install PHP 7.4 met with "unmet dependencies", how to solve this?

I know a lot of topics have the same question but I've tried everything and nothing works for me. So I'm trying to install php 7.4 on my ubuntu stretch. I've done the following commands I found on the Internet:

apt install ca-certificates apt-transport-https wget gnupg
wget -q https://packages.sury.org/php/apt.gpg -O- | apt-key add -
echo "deb https://packages.sury.org/php/ buster main" | tee /etc/apt/sources.list.d/php.list
apt update
apt install php7.4

And then I get the error:

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.4 : Depends: libapache2-mod-php7.4 but it is not going to be installed or
                   php7.4-fpm but it is not going to be installed or
                   php7.4-cgi but it is not going to be installed
          Depends: php7.4-common but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

I saw that someone followed the error by trying to install the depedencies that were causing the problem. So I then did

apt install php7.4-common
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.4-common : Depends: libc6 (>= 2.27) but 2.24-11+deb9u4 is to be installed
E: Unable to correct problems, you have held broken packages.

I saw somewhere that it could be something in my /etc/apt/sources.list so here it is:

# Generated by distrobuilder
deb http://deb.debian.org/debian stretch main
deb http://security.debian.org/debian-security stretch/updates main

I'm stuck, I don't see what's wrong. Could you help? Thanks

like image 612
Akame14 Avatar asked Jul 24 '20 07:07

Akame14


1 Answers

please try below commands for Ubuntu:

sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt update
like image 176
Anant Vikram Singh Avatar answered Dec 06 '22 23:12

Anant Vikram Singh