1

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?

Buckket5
  • 73
  • 2
  • 8

1 Answers1

3

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 

Source

PHELMS
  • 92
  • 2
  • 9
  • 3
    You also need to state where these packages come from and why you are recommending them. – Michael Hampton Feb 26 '17 at 22:56
  • 1
    The repository is maintained by the the maintainer of PHP in Debian proper: https://qa.debian.org/developer.php?login=ondrej%40debian.org – jordanm Feb 27 '17 at 00: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` – Czar May 22 '17 at 01:53