Processing... Please wait...

Product was successfully added to your shopping cart.

Install php 7.0 / 7.1 on Debian 9 stretch

Debian 9 stretch is here and it is the latest and greatest debian linux release.

Install php 7 on Debian 9 Install php 7 on Debian 9

In this article I will show you how to install the fastest PHP ever made - php 7.0 and php 7.1 on it.


Install php 7.0 on Debian 9

7.0 installation is quite easy - all you have to do is first update aptitude:

apt-get update

Then install php7.0 package:

apt-get install php7.0

If you need any php extension (for example php7.0-fpm) you can repeat the procedure:

apt-get install php7.0-fpm


Install php 7.1 on Debian 9

There is no php 7.1 package for debian 9 as of today so we will compile 7.1 from source.

Download the latest 7.1 from the official website. In our case that will be php 7.1.7:

tar jxvf php-7.1.7.tar.bz2

Next we need to install essential tools to build software from source code:

apt-get install build-essential

And some development packages:

apt-get install libxml2-dev libmcrypt-dev libjpeg-dev


Configure and make PHP 7.1

We configure php 7.1 with the minimum options:

./configure --with-mcrypt

You are welcome to include any other options - see the full list by running ./configure --help

Then we issue make and relax for half an hour while it is all compiling:


If everything is OK go ahead and install it into /usr/local/bin:

make install

Now you have your php 7.1 setup on debian 9:

root@debian:~/php-7.1.7# /usr/local/bin/php -v
PHP 7.1.7 (cli) (built: Jul 31 2017 17:33:15) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies

Any questions - do no hesitate to ask!



If you find this post interesting do not hesitate to sign up for our newsletter and join the 845 people who receive Magento news, tips and tricks regularly.

Thank You!