Unable to locate package php7.4

Posted July 22, 2021 2.7k views
PHPDebian 9

I am trying to upgrade php7.4 version but i am getting this issue “Unable to locate package php7.4” on debian Debian 9.4

and i check shources.list

deb stretch main contrib non-free
deb-src stretch main contrib non-free

deb stretch/updates main contrib non-free
deb-src stretch/updates main contrib non-free
deb stretch-updates main contrib non-free
deb-src stretch-updates main contrib non-free

wrong on shources.list or what?
could you solve please?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

Hi @dwiady,

In order to install PHP 7.4, you need to download and store PPA repository in a file on your Debian Server + the GPG key. To do so, run the following commands:

sudo apt -y install lsb-release apt-transport-https ca-certificates 
sudo wget -O /etc/apt/trusted.gpg.d/php.gpg

Once you’ve done this, add the repository:

echo "deb $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php.list

Now Update your System and install your PHP version:

sudo apt update
sudo apt -y install php7.4


  • Thanks…
    then i got this message, after i command “sudo a2enmod php7.4” for activated php 7.4..

    Considering dependency mpmprefork for php7.4:
    Considering conflict mpm
    event for mpmprefork:
    Considering conflict mpm
    worker for mpmprefork:
    Module mpm
    prefork already enabled
    COnsidering conflict php5 for php7.4:
    Module php7.4 already enabled

    could you solve please?