Error while installing php 7.2 in ubuntu 17.04

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.


I had a similar problem. This page helped me resolve it. https://tecadmin.net/install-php-debian-9-stretch/

specifically, running these commands prior to the php install

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/ stretch main" | sudo tee /etc/apt/sources.list.d/php.list