How to install PHP 7.1 on GNU/Linux Debian 8.7 (jessie) server?

This tutorial will explain how to install PHP and its dependent packages on GNU Linux. If the Linux is installed with minimal packages,  then you need to install packages such as add-apt-repository, apt-transport-https, ca-certificates etc., as these packages will be used to download the other packages during apt-get install.

Step 1: Install apt-transport-https and ca-certificates using apt-get

#apt-get install install apt-transport-https ca-certificates

Step 2: Find out the release info with the below command

#lsb_release -sc

If you don’t find the above command, then you need to install the package lsb-release

# apt-get install lsb-release

Step 3: Add PHP 7.1 repository

Based on your release info, add the repository which contains PHP 7.1 to the repository list. Append the below info to the already existing repository list in the file: /etc/apt/sources.list

# vim /etc/apt/sources.list
deb https://packages.sury.org/php/ <release_info> main
deb https://packages.sury.org/php/ <release_info> main

Example:

deb https://packages.sury.org/php/ jessie main
deb https://packages.sury.org/php/ jessie main

Step 4: Update apt database to include new packages

# apt-get update

Step 5: Install PHP 7.1 along with other necessary packages

# apt-get install php7.1 libapache2-mod-php7.1 php7.1-cgi php7.1-fpm php7.1-gd php7.1-mysql

Step 6: Verify the PHP installation using phpinfo() in index.php. Below is the snapshot

install PHP 7.1 on Debian 8.7 Linux


Related Content
vps germany
Disclaimer: The content published in this article is the views of the author only. Techglimpse does not gurantee accuracy, completness or validity. If you believe the content on this post violates your copyright, please send us a mail for removal. Read more.