How can I install PHP / PHP 7.3 on Debian 10 Buster Linux?. This guide will walk you through the steps to install PHP 7.3 on Debian 10 Buster. For Apache web server users, you’ll need to install libapache2-mod-php which allows you to host and serve PHP applications with Apache web server.

Debian 10 Buster has PHP 7.3 as the default version installable. The only pre-requisite for this setup is pre-installed Debian 10 and user account with sudo access.

Step 1: Update system

As always, we recommend updating software repositories and installe packages to sync with latest releases.

sudo apt update && sudo apt -y upgrade

Step 2: Install PHP / PHP 7.3 on Debian 10 Buster

The next step is installation of PHP 7.3 on Debian 10. Run the following commands on your Debian 10 terminal to install PHP 7.3.

sudo apt -y install php php-common

Confirm PHP version.

$ php -v
PHP 7.3.3-1 (cli) (built: Mar 7 2019 19:43:34) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.3, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.3.3-1, Copyright (c) 1999-2018, by Zend Technologies

Step 3: Installing PHP Extensions on Debian 10 Buster

PHP extensions can be installed on demand. Here I’ll show installation of most common PHP extensions required for basic usage.

sudo apt -y install php-cli php-fpm php-json php-pdo php-mysql php-zip php-gd  php-mbstring php-curl php-xml php-pear php-bcmath

Step 4: Using PHP with Apache Web Server

You need to have installed Apache Web Server, see below:

How to Install LAMP Stack on Debian 10 Buster

Then install libapache2-mod-php

sudo apt -y install libapache2-mod-php

Enable Apache module if not already enabled then restart the Web Server.

$ sudo a2enmod php7.3 
Considering dependency mpm_prefork for php7.3:
Considering conflict mpm_event for mpm_prefork:
Considering conflict mpm_worker for mpm_prefork:
Module mpm_prefork already enabled
Considering conflict php5 for php7.3:
Module php7.3 already enabled

$ sudo systemctl restart apache2

There you have it. PHP 7.3 has been installed on Debian 10 (Buster). For installation of PHP 7.3 on other systems, check below:

How to install PHP 7.3 / PHP 7.3-FPM on Linux Mint 19

How to Install PHP 7.3 on Arch Linux and Manjaro

How to Install PHP 7.3 on Debian 9 / Debian 8

How to install PHP 7.3 on Ubuntu 18.04 / Ubuntu 16.04 /

How to Install PHP 7.3 on CentOS 7 / Fedora