If there is one thing that distinguishes Debian from other distributions, it is stability. However, this stability has a “price” that is to sacrifice a little the most recent versions of the programs. And that I have noticed that this version of Debian incorporates quite current software, but there are always some that are left. An example is PHP that in the Debian repositories appears version 7.2 but 7.3 is already mature. In some cases, you may need it. That is why, in this post, I will help you install PHP 7.3 on Debian 10. This way you will have the latest version of this programming language.
PHP 7.3 features
PHP 7.3 is the third minor update to branch 7. It includes many security enhancements and bug fixes, making it a pretty good version for developing applications. However, some of its most important new features are the following:
- Flexible Heredoc and Nowdoc Syntax.
- PCRE2 Migration.
- Multiple MBString Improvements.
- LDAP Controls Support.
- Improved FPM Logging.
- Windows File Deletion Improvements.
- Several Deprecations.
Of course, to consult the rest of the features, you can read it in the release notes.
Install PHP 7.3 on Debian 10
To install PHP 7.3 on Debian 10, we have to use an external repository. However, it is quite secure. First, open a terminal session or connect to your server.
Then, install some packages needed for the process.
:~$ sudo apt install apt-transport-https lsb-release ca-certificates
Since we are adding an external repository, we need to add its security key.
:~$ sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
Next, add the repository to install PHP 7.3 on Debian 10.
:~$ sudo sh -c 'echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'
Then, refresh the APT cache.
:~$ sudo apt update
So, PHP 7.3 is now available to be installed. But we will use APT to search for PHP 7.3 packages.
:~$ sudo apt search php7.3 php7.3/unknown 7.3.7-2+0~20190725.42+debian10~1.gbp848ca5 all server-side, HTML-embedded scripting language (metapackage) php7.3-cgi/unknown 7.3.7-2+0~20190725.42+debian10~1.gbp848ca5 amd64 server-side, HTML-embedded scripting language (CGI binary) php7.3-cgi-dbgsym/unknown 7.3.7-2+0~20190725.42+debian10~1.gbp848ca5 amd64 debug symbols for php7.3-cgi php7.3-cli/unknown 7.3.7-2+0~20190725.42+debian10~1.gbp848ca5 amd64 command-line interpreter for the PHP scripting language
Then, install PHP 7.3 by typing the following command:
:~$ sudo apt install php7.3 php7.3-cli
After that check the PHP version.
:~$ php -v PHP 7.3.7-2+0~20190725.42+debian10~1.gbp848ca5 (cli) (built: Jul 25 2019 11:53:58) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.3.7, Copyright (c) 1998-2018 Zend Technologies with Zend OPcache v7.3.7-2+0~20190725.42+debian10~1.gbp848ca5, Copyright (c) 1999-2018, by Zend Technologies
And that is it.
To have the last versions of the programs can take us many advantages especially in subjects of security. PHP being a critical component of web applications, then it is convenient in some cases to have its most recent stable version.
Please share this post with your friends, and join our Telegram channel.