Php is a popular programming language commonly used for building web based applications. Most Linux distributions provide Php out of the box. However the version of Php in most cases is not the current stable version.
To install the latest stable version of Php, we need to use a third part package repository such as deb.sury.org/. To use this repository we need to follow the instructions given on: https://packages.sury.org/php/README.txt.
After that we can install the latest version of Php. For example to install Php 7.2, we need to issue the commands: apt-get update followed by apt-get install Php7.2.
To revert to the version of Php provided by the operating system, we need to remove the file: /etc/apt/sources.list.d/php.list. We also need to remove the package singing key for deb.sury. Next we need to run the commands: apt-get update followed by apt-get remove Php7.2. After that we need to install the Php package using: apt-get install php. This will install the version of Php that is provided by the operating system.