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:
How to install PHP 7.3 on Ubuntu
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
Fedora 29 / Fedora 28: How to Install PHP 7.3 on Fedora
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 / Ubuntu
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.
PHP Web Programming Video Courses:
- The Complete Web Developer Course
- PHP for Beginners – Become a PHP Master – CMS Project
- The Complete PHP Full Stack Web Developer Bootcamp
- PHP with Laravel for beginners – Become a Master in Laravel
- PHP OOP: Object Oriented Programming for beginners + Project