When it comes to my Linux-systems I prefer Ubuntu-based distributions and especially Debian for my servers. Debian does not include the latest versions but focuses on stability mainly. Once you use applications that take advantage of the speed improvements of PHP 7.2, you need to tweak Debian 9 ("Stretch") a little bit: It comes with PHP 7.0 so there are some switches to be pulled depending on your needs. In this really short tutorial I will show you how to accomplish this.

As PHP 7.3 has been released some time ago, bringing some great new features to the language such as trailing commas in function calls, throwing errors when JSON parsing fails, array_key_first()/ array_key_last()functions, and much more are nice improvements besides the speed-factor. To lift our Debian 9-installation and provide the packages needed, we have first to implement PHP 7.3 -respositories maintained by Ondřej Surý's PPA:

sudo apt-get install -y apt-transport-https lsb-release ca-certificates wget sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php.list sudo apt-get update

Once we have done this, we may install PHP 7.3 with all default packages by typing

sudo apt-get install php

Or - to be more precise - we may also enter the desired packages which comes quite handy if you set your environment up from the scratch and just need some specific modules:

sudo apt-get install php-cli php-fpm php-bcmath php-curl php-gd php-intl php-json php-mbstring php-mysql php-opcache php-sqlite3 php-xml php-zip

Please mind that PHP 7.3 is standard from that moment on so if you install any PHP module, it will likely be one of version 7.3!

Generally this should just been done if you have good reasons for that - Debian's approach is the stable and not the experimental one! Ondřej Surý's packages are known to flow in Debian's standard repositories over the time but who knows if Debian 10 will ship with PHP 7.2? If you don't have any good reason to upgrade to PHP 7.3 I think you should go with 7.0, otherwise feel free to speed up your installation according to your needs of course!