Install PHP 7.3

Posted by Morgan Billingsley on December 30, 2019 5:44 pm

Step 1: Get signing key and PHP 7.3 PPA

Update apt:

sudo apt update

Get the signing key and PPA:

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

Step 2: Install PHP 7.3

Update Apt again:

sudo apt update

Install php:

sudo apt install php7.3

Check if php was installed correctly:

php -v

If everything was installed correctly, you should see something similar to this:

PHP 7.3.13-1+0~20191218.50+debian9~1.gbp23c2da (cli) (built: Dec 18 2019 15:03:24) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.13, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.3.13-1+0~20191218.50+debian9~1.gbp23c2da, Copyright (c) 1999-2018, by Zend Technologies

Step 4 (Optional): Install PHP packages

apt install php7.3-mbstring php7.3-mysql php7.3-xml