PHP 7.3 is the latest stable release available for the installation. This tutorial will help you with the installation of PHP latest version on your Debian system. Now follow this tutorial to Install PHP on Debian 10, Buster.
Debian 10 is still under development. So this tutorial is tested with Debian 10 daily build version.
Prerequisites
Login to your Debian 10 system using shell access. For remote systems connect with SSH. Windows users can use Putty or other alternatives applications for SSH connection.
Run below commands to upgrade the current packages to the latest version.
sudo apt update sudo apt upgrade
Setup PPA on Debian 10
Letβs execute the following commands to install the required packages first on your system. Then import packages signing key. After that configure PPA for the PHP packages on your system.
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/ buster main" | sudo tee /etc/apt/sources.list.d/php.list
You Debian 10 system is ready for the PHP installation.
Install PHP on Debian 10
You can also install the latest PHP version on your system. Run the following commands to install PHP 7.3 on Debian 10. To install other PHP version change php7.3 with your versions like “php7.2”, “php7.1” or “php5.6” etc.
sudo apt update sudo apt install php7.3
Also, install the required PHP modules.
sudo apt install php7.3-cli php7.3-common php7.3-curl php7.3-gd php7.3-json php7.3-mbstring php7.3-mysql php7.3-xml
Check Active PHP Version
After installation verifies the installed and active PHP version using the following command.
php -v PHP 7.3.6-1+0~20190531112640.39+buster~1.gbp6131b7 (cli) (built: May 31 2019 11:26:40) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.3.6, Copyright (c) 1998-2018 Zend Technologies with Zend OPcache v7.3.6-1+0~20190531112640.39+buster~1.gbp6131b7, Copyright (c) 1999-2018, by Zend Technologies
Congratulation! Enjoy the development with PHP on Debian 10 Buster system.
9 Comments
Thanks. One problem / request: why does “sudo apt install php7.3″ automatically install the additional packages ” apache2 apache2-bin apache2-data apache2-utils libapache2-mod-php7.3″? I have already got nginx installed, therefore I only require PHP itself.
The solution I used for now was “sudo apt remove –purge apache2 apache2-bin apache2-data apache2-utils libapache2-mod-php7.3” followed by “sudo apt auto-remove”. However I’m sure there is a better way.
Thanks!
I like this article, the only issue I have is that I dod not wish to remove my index.html – hence I was not able to access the mail login. Do you have any suggestions?
sudo echo “deb https://packages.sury.org/php/ buster main” | tee /etc/apt/sources.list.d/php.list
should be
echo “deb https://packages.sury.org/php/ buster main” | sudo tee /etc/apt/sources.list.d/php.list
Thanks Zeno
Hi Rahul,
Thank you for your efforts here π
Only missing part when used on Raspbian Buster on a RPi is:
In your setup PPA third command you need a sudo for the last command:
sudo echo “deb https://packages.sury.org/php/ buster main” | sudo tee /etc/apt/sources.list.d/php.list
else you will get an error:
sudo echo “deb https://packages.sury.org/php/ buster main” | tee /etc/apt/sources.list.d/php.list
Br, Olav
Thanks Olav
How can I go back to PHP7.3 from Buster when I go this way?
Thanks for your answer!
remove everything you find that you installed when you search php7.4 – install the same pacakges ending in php7.3 – restart server.