I got this error when run below command
sudo apt install php7.2 php7.2-common php7.2-cli php7.2-fpm
Reading state information... Done
E: Unable to locate package php7.2
E: Couldn't find any package by glob 'php7.2'
E: Couldn't find any package by regex 'php7.2'
E: Unable to locate package php7.2-common
E: Couldn't find any package by glob 'php7.2-common'
E: Couldn't find any package by regex 'php7.2-common'
E: Unable to locate package php7.2-cli
E: Couldn't find any package by glob 'php7.2-cli'
E: Couldn't find any package by regex 'php7.2-cli'
E: Unable to locate package php7.2-fpm
E: Couldn't find any package by glob 'php7.2-fpm'
E: Couldn't find any package by regex 'php7.2-fpm'
You need to manually add the ondrej PPA
to be able to install PHP7.2 on Ubuntu 17.
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php7.2
Or, by compiling it from the source by cloning the git repository, checking out the version that you want, make & make install
For more informations about compiling PHP from the source check out how to build/compile PHP from the source.