Install PHP 7.3 on Debian Stretch


This tutorial will show you how to easily use PHP 7.3 on Debian Stretch. You’ll notice that Debian Stretch only comes with PHP 7.0 and if you want better performance and the latest features, you might want to look at installing PHP 7.3 instead.

I’m going to show you to add the DEB SURY PHP package repo which will allow you to easily install PHP 7.3 on Debian Stretch. The DEB SURY PHP package repo was created and currently being run by Ondřej Surý, the official maintainer of PHP in Debian and Ubuntu. This means that the PHP 7.3 packages you install via this tutorial will be highly compatible when it comes to upgrading to the future Debian release which is Debian Buster.

PHP Logo


Before adding the PHP 7.3 package repo, you need to make sure you have the following packages installed on your Debian Stretch install.

sudo apt install apt-transport-https lsb-release ca-certificates

With those packages now installed, you’re ready to move on to the next step.

Adding the PHP 7.3 Package Repo

To get started with adding the PHP 7.3 package repo, you’re first going to need to download the apt gpg key for DEB SURY PHP:

sudo wget -O /etc/apt/trusted.gpg.d/sury-php.gpg

and now you can add the actual repo by creating this file with nano:

sudo nano /etc/apt/sources.list.d/sury-php.list

and add the following to it:

deb stretch main
deb-src stretch main

Save the file and exit.

Now refresh your Debian package list with:

sudo apt update

and you’re finally ready to install PHP 7.3 on Debian Stretch!

Installing PHP 7.3

With the DEB SURY PHP repository now installed, you can simply use apt to install the base PHP 7.3 package:

sudo apt install php7.3

If you plan on installing WordPress or similar software then you’ll want to add PHP-FPM and some extra PHP packages

sudo apt install php7.3-fpm php7.3-mysql php7.3-opcache php7.3-gd php7.3-curl php7.3-xml php7.3-zip php7.3-tidy php7.3-json php7.3-mbstring php7.3-readline


Congratulations! By following this tutorial, you should now have any PHP 7.3 packages you want installed on your Debian Stretch system! If you have any questions or need any help with the steps, please leave a comment or contact me.

Leave a Reply

Your email address will not be published. Required fields are marked *