PHP 7.2 is the latest stable release available for the installation. This tutorial will help you with the installation of multiple PHP versions on your system. Now follow this tutorial to Install PHP on Debian 8 Jessie.

Advertisement

Prerequisites

Login to your Debian 8 system using shell access. For remote systems connect with SSH. Windows users can use Putty or other alternatives applications for SSH connection.

ssh root@debian8

Run below commands to upgrade the current packages to the latest version.

sudo apt update 
sudo apt upgrade

Enable PHP PPA on Debian 8

Let’s execute the following commands to install the required packages first on your system. Then import packages signing key. After that configure PPA for the PHP packages on your system.

sudo apt install ca-certificates apt-transport-https 
wget -q https://packages.sury.org/php/apt.gpg -O- | sudo apt-key add -
sudo echo "deb https://packages.sury.org/php/ jessie main" | tee /etc/apt/sources.list.d/php.list

You Debian 8 system is prepared for the PHP installation. Install the required PHP on Debian 8 system using the following options.

Installing PHP 7.2

You can also install the Latest PHP version on your system. Run the following commands to install PHP 7.2 on Debian 8.

sudo apt update
sudo apt install php7.2

Also install required php modules.

sudo apt install php7.2-cli php7.2-common php7.2-curl php7.2-gd php7.2-json php7.2-mbstring php7.2-mysql php7.2-xml

Installing PHP 7.1

If your application has the specific requirement of PHP 7.1, You can use the following commands for installing PHP 7.1 on Debian 8 Jessie.

sudo apt update
sudo apt install php7.1

Also, install the required PHP modules.

sudo apt install php7.1-cli php7.1-common php7.1-curl php7.1-gd php7.1-json php7.1-mbstring php7.1-mysql php7.1-xml

Installing PHP 5.6

For the older PHP application depends on PHP 5. Execute the following commands for installing PHP 5.6 on your Debian 8 Jessie.

sudo apt update
sudo apt install php5.6

Also install required php modules.

sudo apt install php5.6-cli php5.6-common php5.6-curl php5.6-gd php5.6-json php5.6-mbstring php5.6-mysql php5.6-xml

Congratulation! Enjoy the development with PHP 7.2, PHP 7.1 or PHP 5.6 on Debian 8 Jessie system.

Share.

17 Comments

    • Hello,
      I confirm what Andre says, impossible to find reliable repository on sury.org website. This is what we can get :

      > Index of /php/dists/
      > ../
      > buster/ 09-Sep-2020 22:27 –
      > stretch/ 17-Sep-2020 12:23

      The repo “jessie” is missing. Does someone here know an old repo which works to get PHP7.2 on Jessie ?
      Thanks

    • I have found very useful Bitnami LAPP stack. This way I’ve got PHP 8.0! It will serve me long, I thought. Then I discovered the software (Hubzilla) does not support PHP 8.0 due to curly braces index syntax, deprecated as of PHP 7.4. So Hubzilla can only work on PHP 7.1, 7.2 and 7.3. Not more early, not more recent. This is so ridiculous. Happily, I had no problem obtaining LAPP 7.3 stack from same Bitnami.

  1. RAHUL:

    Thank you for creating this tutorial!

    I had PHP 5.6 running on Debian and wanted to upgrade to 7.2., but none of the guides I tried worked.

    However, your steps did work, and I am now running 7.2 on my VPS!

    Thank you once again for this guide, very very helpful!

  2. I’m getting the error below for php 7.1 on Debian 8/Jessie:

    ======================================

    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    Some packages could not be installed. This may mean that you have
    requested an impossible situation or if you are using the unstable
    distribution that some required packages have not yet been created
    or been moved out of Incoming.
    The following information may help to resolve the situation:

    The following packages have unmet dependencies:
    php7.1 : Depends: libapache2-mod-php7.1 but it is not going to be installed or
    php7.1-fpm but it is not going to be installed or
    php7.1-cgi but it is not going to be installed
    Depends: php7.1-common but it is not going to be installed
    E: Unable to correct problems, you have held broken packages.

  3. Nguyen Thanh Tung on

    Install PHP 7.1 on Debian 8 works well. Thank you.

    BTW, you should correct this text (a copy/paste error) to Sury repo instead of Dotdeb PPA:
    Firstly you need to add Dotdeb PPA on your system. Before adding PPA first import the GPG key of Dotdeb repository.

Exit mobile version