(Last Updated On: November 28, 2018)

This short tutorial is for installing PHP 7.3 on Debian 9 (Stretch) and Debian 8 (Jessie). With PHP 7.3 comes a number of bug fixes, new functionalities and features as well as a number of deprecations.

As of this writing, the current release of PHP 7.3 is RC 6. This article will be updated as soon as the stable LTS release is available for the general public. This release of PHP is for  development and testing purposes and should not be used in Production environment.

For Ubuntu 18.04 / Ubuntu 16.04, use:

How to install PHP 7.3 on Ubuntu 18.04 / Ubuntu 16.04

If you’re running a CentOS 7 system, then follow the guide on the link below:

How to Install PHP 7.3 on CentOS 7

Install PHP 7.3 on Debian 9 / Debian 8

Follow the steps provided below to install 7.3 on Debian 9 / Debian 8

Step 1: Update system and Install add-apt-repository

Ensure your system is updated:

sudo apt update
sudo apt upgrade -y

If you don’t have add-apt-repository command available in your system, install it using our guide below:

How to Install add-apt-repository on Debian 9 / Ubuntu 18.04/16.04

Step 2: Add  PHP 7.3 PPA repository

Once add-apt-repository command is available, add PHP 7.3 PPA repository

sudo apt -y install lsb-release apt-transport-https ca-certificates
sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php7.3.list

Step 3: Install PHP 7.3 on Debian 9 / Debian 8

The last step is to Install PHP 7.3 on Debian 9 / Debian 8. First run the apt update command:

$ sudo apt update
Hit:2 https://packages.sury.org/php stretch InRelease
Ign:1 http://cdn-fastly.deb.debian.org/debian stretch InRelease
Hit:3 http://cdn-fastly.deb.debian.org/debian stretch Release
Reading package lists... Done
Building dependency tree 
Reading state information... Done
4 packages can be upgraded. Run 'apt list --upgradable' to see them.

Then install  PHP 7.3 on Debian 9 / Debian 8:

sudo apt -y install php7.3

Check version installed

$ php -v
PHP 7.3.0RC6 (cli) (built: Nov 25 2018 11:18:12) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.0-dev, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.3.0RC6, Copyright (c) 1999-2018, by Zend Technologies

Step 4: Installing PHP 7.3 Extensions

Install PHP 7.3 extensions by using the syntax

 sudo apt install php7.3-<entension-name>

See example below which install standard PHP extensions.

sudo apt install php7.3-cli php7.3-fpm php7.3-json php7.3-pdo php7.3-mysql php7.3-zip php7.3-gd  php7.3-mbstring php7.3-curl php7.3-xml php7.3-bcmath php7.3-json

To install Apache Module for PHP, run:

sudo apt install libapache2-mod-php7.3

Confirm one:

$ apt policy php7.3-cli
  Installed: 7.3.0~rc6-1+0~20181125111811.22+stretch~1.gbp3c599f
  Candidate: 7.3.0~rc6-1+0~20181125111811.22+stretch~1.gbp3c599f
  Version table:
 *** 7.3.0~rc6-1+0~20181125111811.22+stretch~1.gbp3c599f 500
        500 https://packages.sury.org/php stretch/main amd64 Packages
        100 /var/lib/dpkg/status

Congratulations!!. You have successfully installed PHP 7.3 on Debian 9 / Debian 8.