Facebook Twitter Instagram
    TecAdmin
    • Home
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    You are at:Home»Programming»PHP»How To Install PHP (7.2, 7.1 & 5.6) on Debian 8 Jessie

    How To Install PHP (7.2, 7.1 & 5.6) on Debian 8 Jessie

    By RahulJuly 31, 20182 Mins Read

    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 [email protected]
    

    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.

    PHP PHP 5.6 PHP 7.0 PHP on Debian
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp

    Related Posts

    How to Prevent SQL-injection in PHP using Prepared Statements

    Preventing SQL injection attacks with prepared statements in MySQL

    PHP Arrays: A Beginner’s Guide

    View 17 Comments

    17 Comments

    1. Andrea on July 30, 2020 7:54 am

      Hello, thank you for your tutorial. Unfortunately it seems that it does not work anymore with Debian 8 Jessie. I can’t find the repo in https://packages.sury.org/php/dists/ . Do you have any suggestion to overcome this problem? Thanks!

      Reply
      • CYM on September 21, 2020 1:36 pm

        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

        Reply
      • Ivan Levashev on December 30, 2020 2:59 pm

        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.

        Reply
    2. ic317nv on July 2, 2020 6:37 pm

      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!

      Reply
    3. Tom on June 1, 2019 4:11 pm

      Can the 3 versions co-exist on Debian 8 Jessie?

      Reply
      • Rahul on June 3, 2019 4:24 am

        Yes, you can install multiple PHP version. You can also select the differnt PHP version for websites.

        https://tecadmin.net/install-multiple-php-version-with-apache-on-debian/

        Reply
    4. Peter on November 18, 2018 8:01 pm

      Do you have a tutorial on Debian Wheezy 7.11 and php 7.x?

      Reply
    5. Anonymous on June 13, 2018 1:08 pm

      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.

      Reply
      • Emma on July 30, 2018 5:34 pm

        Were you able to resolve this?

        Reply
        • Rahul K. on July 31, 2018 5:22 am

          Hi EMMA,

          There was some issue with PPA command. I have corrected the command in section “Enable PHP PPA on Debian 8”.

          Please try now.

          Reply
          • vinoc on February 4, 2019 10:43 am

            It doesn’t work…. I think it’s because i have ARMEL architecture….

            Reply
    6. Jose Patricio Figueroa Bello on February 26, 2018 6:22 pm

      Gracias, de verdad que me ha servido su excelente post. Felicidades

      Reply
    7. Raju ginne on February 15, 2018 6:39 am

      i just installed php 7.2 on debian 9 using /packages.sury.org/php/

      Reply
    8. Raju ginne on September 8, 2017 5:52 am

      thank you its worked Debian8 Jessie

      Reply
    9. Nguyen Thanh Tung on August 1, 2017 8:30 am

      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.

      Reply
    10. Jabb on April 21, 2017 7:19 am

      How to choose witch php to use?
      For example, for folder /qaz I want to have php5, for folder zaq I want php7.

      Reply
    11. burak on April 12, 2017 1:28 am

      PHP7 is not available on Debian 7 Wheezy. It won’t work. Fyi.

      Reply

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • Implementing a Linux Server Security Audit: Best Practices and Tools
    • cp Command in Linux (Copy Files Like a Pro)
    • 15 Practical Examples of dd Command in Linux
    • dd Command in Linux (Syntax, Options and Use Cases)
    • Iptables: Common Firewall Rules and Commands
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.