• Home
  • Ubuntu 18.04
    • Whats New?
    • Upgrade Ubuntu
    • Install Java
    • Install Node.js
    • Install Docker
    • Install Git
    • Install LAMP Stack
  • Tutorials
    • AWS
    • Shell Scripting
    • Docker
    • Git
    • MongoDB
  • Funny Tools
  • FeedBack
  • Submit Article
  • About Us
TecAdmin
Menu
  • Home
  • Ubuntu 18.04
    • Whats New?
    • Upgrade Ubuntu
    • Install Java
    • Install Node.js
    • Install Docker
    • Install Git
    • Install LAMP Stack
  • Tutorials
    • AWS
    • Shell Scripting
    • Docker
    • Git
    • MongoDB
  • Funny Tools
  • FeedBack
  • Submit Article
  • About Us

How To Install PHP (7.3, 7.2 & 5.6) on Debian 9 Stretch

Written by Rahul, Updated on June 10, 2019
PHP Debian 9, install php, PHP, PHP 5.6, PHP 7.1, PHP 7.2, PHP 7.3

The PHP 7.3 is the latest version available for installation on Debian 9 Stretch Linux machine. Ubuntu users can visit our tutorial for installing PHP 7 on Ubuntu. This tutorial is for the Debian 9 Stretch users to install PHP 7.3, 7.2, 7.1 or 5.6 on their system.

First of all, you need to complete the prerequisites step and then go forward to install the PHP version of your choice or requirements.

Prerequisites

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

ssh root@debian9

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

sudo apt update 
sudo apt upgrade

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 -
echo "deb https://packages.sury.org/php/ stretch main" | sudo tee /etc/apt/sources.list.d/php.list

Now use one of the below options to install PHP of your requirements.

Installing PHP 7.3

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

sudo apt update
sudo apt install php7.3

Also install required php modules.

sudo apt install php7.3-cli php7.3-common php7.3-curl php7.3-mbstring php7.3-mysql php7.3-xml

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 9.

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-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 9 Stretch system.

sudo apt update
sudo apt install php7.1

Also, install the required PHP modules as per your requirements. Here is a list of some frequently used modules.

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

Installing PHP 5.6

Execute the following commands for installing PHP 5.6 on your Debian 9 Stretch system.

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-mbstring php5.6-mysql php5.6-xml

Share it!
Share on Facebook
Share on Twitter
Share on Google+
Share on Reddit
Share on Tumblr
Rahul
Rahul
Connect on Facebook Connect on Twitter Connect on Google+

I, Rahul Kumar am the founder and chief editor of TecAdmin.net. I am a Red Hat Certified Engineer (RHCE) and working as an IT professional since 2009..

Related Posts

  • How to Install Composer on MacOS

    September 6, 2019
  • How to Use TLS 1.2 with cURL PHP

    August 11, 2019
  • How To Install Ioncube for PHP in Debian Linux

    July 16, 2019
  • How to check if string contains specific word in PHP

    June 20, 2019
  • How to Install Apache 2.4 & PHP 7.3 on Amazon Linux

    June 11, 2019

29 Comments

  1. Avatar Xenx Reply to Xenx
    September 14, 2019 at 6:35 pm

    thank you very much for this instruction. Save me many time.

  2. Avatar ildgz Reply to ildgz
    May 29, 2019 at 11:19 pm

    Great! From php 7.0 to 7.3, needed to Laravel 5.8, works for me on Debian 9.

  3. Avatar Gonzalo Oviedo Reply to Gonzalo
    May 19, 2019 at 6:39 pm

    This answer is not in StackOverflow.

    Something so simple like adding in source.list the php sources, allows you to download the php7.3-curl

« Previous 1 2 3

Leave a Reply

Cancel reply

Popular Posts

  • How To Install MySQL on Debian 10 (Buster) Linux
  • How To Upgrade Debian 9 to Debian 10 Buster
  • How to Install PostgreSQL 11 on Debian 10 (Buster)
  • How to Install Docker on Debian 10 (Buster)
  • How To Install Go 1.12 on MacOS
Copyright © 2013-2019 TecAdmin.net. All Rights Reserved. This site uses cookies. By using this website you agree with our term and services
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.OkNo
Revoke cookies