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.

For Ubuntu 18.04 / Ubuntu 16.04, use:

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

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
[ -e /var/run/reboot-required ] && sudo reboot

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

Step 2: Add  PHP 7.3 PPA repository

Once the 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/php.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.29-1+0~20210701.86+debian9~1.gbp7ad6eb (cli) (built: Jul  1 2021 16:11:36) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.29, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.3.29-1+0~20210701.86+debian9~1.gbp7ad6eb, 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
php7.3-cli:
  Installed: 7.3.29-1+0~20210701.86+debian9~1.gbp7ad6eb
  Candidate: 7.3.29-1+0~20210701.86+debian9~1.gbp7ad6eb
  Version table:
 *** 7.3.29-1+0~20210701.86+debian9~1.gbp7ad6eb 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.

Web Development books you can read:

YOU CAN SUPPORT OUR WORK WITH A CUP OF COFFEE


As we continue to grow, we would wish to reach and impact more people who visit and take advantage of the guides we have on our blog. This is a big task for us and we are so far extremely grateful for the kind people who have shown amazing support for our work over the time we have been online.

Thank You for your support as we work to give you the best of guides and articles. Click below to buy us a coffee.

1 COMMENT

LEAVE A REPLY

Please enter your comment!
Please enter your name here