In this article, we will have explained the necessary steps to install and configure PHP 7.3 on Debian 10. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.
PHP: Hypertext Preprocessor (or simply PHP) is an open-source programming language used for web development, created by Rasmus Lerdorf. It is an HTML-embedded scripting language for creating dynamic web sites. The standard PHP interpreter, powered by the Zend Engine, is free software released under the PHP License. PHP has been widely ported and can be deployed on most web servers on almost every operating system and platform, free of charge. PHP 7.3 is the latest stable version of PHP.
Install PHP 7.3 on Debian
Step 1. The first command will update the package lists to ensure you get the latest version and dependencies.
sudo apt update sudo apt upgrade sudo apt-get install -y curl wget gnupg2 ca-certificates lsb-release apt-transport-https
Step 2. Install PHP 7.3.
First, add SURY repository:
wget https://packages.sury.org/php/apt.gpg sudo apt-key add apt.gpg echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php7.list
Next, installing PHP v7.3 with the following command:
sudo apt update sudo apt install -y php7.3 php7.3-cli php7.3-common
Verify the PHP installation, by typing the following command which will print the PHP version:
# php -v PHP 7.3.1 (cli) (built: May 18 2019 13:36:46) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.3.1, Copyright (c) 1998-2018 Zend Technologies with Zend OPcache v7.3.1, Copyright (c) 1999-2018, by Zend Technologies
If you are using Apache as your web server then just restart the Apache service using the following command and you are good to go:
sudo systemctl restart httpd
Congratulation, you have learned how to install and configure PHP on Debian 10 Buster. If you have any question, please leave a comment below.