I am looking to install at least PHP 7.0 on Debian 8.7 but from searching around I am finding it hard to find a reliable source that shows me how to do it. It seems so difficult, I have come across DotDeb but I read bad things about using it and I am not sure what the best way to install PHP 7.0 on Debian is?
1 Answer
You can install it by adding the repository and using the normal apt package management functions.
#!/bin/bash
sudo apt update
sudo apt install apt-transport-https lsb-release ca-certificates -y
sudo wget -O /etc/apt/trusted.gpg.d/php.gpg \
https://packages.sury.org/php/apt.gpg
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" |
sudo tee /etc/apt/sources.list.d/php.list
sudo apt update
# 7.1 is out so select your number accordingly
sudo apt install php7.X -y
-
3You also need to state where these packages come from and why you are recommending them. Feb 26, 2017 at 22:56
-
1The repository is maintained by the the maintainer of PHP in Debian proper: qa.debian.org/developer.php?login=ondrej%40debian.org– jordanmFeb 27, 2017 at 0:05
-
In my case
$(lsb_release -sc)
causes problems. Had to replace with explicit version name i.e.deb https://packages.sury.org/php/ jessie main
– CzarMay 22, 2017 at 1:53