E: The repository ‘https://packages.sury.org/php stretch Release’ does no longer have a Release file.

When updating your old Debian Stretch server, you experience the following error:
E: The repository 'https://packages.sury.org/php stretch Release' does no longer have a Release file.

Solution:

Use a mirror of the old repository.

echo "deb https://debian.octopuce.fr/snapshots/sury-php/stretch-latest/ 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 -

sudo apt update


Note: if you have Debian Buster or Debian Jessie instead of Debian Stretch, replace the URL.

You can find out about your Debian distro with

lsb_release -a

Sample output for buster:

No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 10 (buster)
Release: 10
Codename: buster

For Debian Buster the fix is
echo "deb https://debian.octopuce.fr/snapshots/sury-php/buster-latest/ buster main" | sudo tee /etc/apt/sources.list.d/php.list

wget -qO - https://debian.octopuce.fr/sury-php/apt.gpg | sudo apt-key add -

sudo apt update


For Debian Jessie its
echo "deb https://debian.octopuce.fr/snapshots/sury-php/jessie-latest/ jessie main" | sudo tee /etc/apt/sources.list.d/php.list

wget -qO - https://debian.octopuce.fr/sury-php/apt.gpg | sudo apt-key add -

sudo apt update

source