How to install PHP 7 in Debian 8? By default, if you install the PHP package in Debian 8, it will install version 5.x. This article, I will guide you to install PHP 7 in Debian 8 using the dotdeb repository.
Add repository PHP 7 dotdeb
Important note: This repository is provided by dotdeb.org. This is not an official repository, you may consider using it. All depends on you, I can not guarantee anything with this repository.
First, you need to add the dotdeb repository address in the source list configuration file of Debian. Type the command below. All the commands below need user root to execute. Otherwise you must type sudo before each command.

echo "deb http://packages.dotdeb.org jessie all" >> /etc/apt/sources.list
echo "deb-src http://packages.dotdeb.org jessie all" >> /etc/apt/sources.listNext, you need to download the gpg key of the new repository. You type the following commands in turn.
cd /tmp
wget https://www.dotdeb.org/dotdeb.gpg
apt-key add dotdeb.gpg
rm -f /tmp/dotdeb.gpgThen, you type update command to update new packages for PHP.
apt-get updateInstall PHP 7 in Debian 8
Now, you can install PHP 7 using the command below.
apt-get install php7.0 php7.0-fpm php7.0-gd php7.0-mysql -yThe above command will install almost all the necessary php packages. The PHP version is 7.0.28-1~dotdeb+8.1.

Once the installation is complete, you can type the following command to see the correct version.
php -v(This is an article from my old blog that has been inactive for a long time, I don’t want to throw it away so I will keep it and hope it helps someone).