tropic
tropic

Reputation: 51

Can't install php 7.2 on Debian 9 (Stretch)

I added repository to install php 7.2 on Debian Stretch.

sudo apt install apt-transport-https lsb-release ca-certificates
sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
sudo sh -c 'echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'
sudo apt update

But when I run apt update - I get an error:

E: The repository 'https://packages.sury.org/php stretch Release' does not have a Release file.


As far as I understand, problem is in my enviroment.
But can't figure out what is the problem.




PS:

My /etc/apt/sources.list:

# deb http://ftp.de.debian.org/debian/ jessie main
# deb http://ftp.de.debian.org/debian/ buster main
deb http://ftp.de.debian.org/debian/ stretch main
deb http://ftp.us.debian.org/debian/ stretch main contrib non-free
deb-src http://ftp.us.debian.org/debian/ stretch main contrib non-free
deb http://security.debian.org/debian-security stretch/updates main contrib non-free
deb http://ftp.by.debian.org/debian/ stretch-updates main
deb http://mirror.yandex.ru/debian/ stretch-backports main contrib non-free
deb http://ftp.debian.org/debian/ stretch-backports main
deb http://dl.winehq.org/wine-builds/debian/ stretch main


There is php.list in /etc/apt/sources.list.d directory with the following line:

deb https://packages.sury.org/php/ stretch main

Upvotes: 4

Views: 16384

Answers (3)

Jason Engage
Jason Engage

Reputation: 497

Just adding a solution since Debian 9 stretch is no longer supported for any php version from sury.org. You can find it here from a backup of sury.org. Download any php version (php8.1 included). Took me way too long to find it! Enjoy

echo "deb https://debian.octopuce.fr/snapshots/sury-php/20220630/ stretch main" | sudo tee /etc/apt/sources.list.d/php.list
wget -qO - https://debian.octopuce.fr/sury-php/apt.gpg | sudo apt-key add -
apt update

Upvotes: 22

dmdip
dmdip

Reputation: 1795

If it helps, these are the exact steps (more or less similar to yours) I used to install php 7.2 on Debian Stretch a few hours ago :

sudo apt install ca-certificates apt-transport-https
wget -q https://packages.sury.org/php/apt.gpg -O- | sudo apt-key add -
echo "deb https://packages.sury.org/php/ stretch main" | sudo tee /etc/apt/sources.list.d/php.list
cd /etc/apt/sources.list.d/
sudo mv ondrej-ubuntu* /tmp
sudo apt -y update
sudo apt install php7.2

Upvotes: 7

dmdip
dmdip

Reputation: 1795

If you find the files listed below in your /etc/apt/sources.list.d/ directory, just remove them and try again :

ondrej-ubuntu-apache2-cosmic.list
ondrej-ubuntu-php-cosmic.list
ondrej-ubuntu-php-cosmic.list.save

Upvotes: 1

Related Questions