Posted on Sunday 10th September 2017
To install php 7.1 on ubuntu, we need to turn to Ondřej Surý, who has been maintaining repositories allowing us to install more modern versions of php for as long as I can remember.
All we need to do is add the PPA Repository to Ubuntu
You can update your system with packages from this PPA by adding ppa:ondrej/php to your system's Software Sources.
sudo add-apt-repository ppa:ondrej/php sudo apt-get update
Now as we have ondrej's PPA available as a source, we can go ahead and install PHP as we normally would with apt-get, we just need to specify the version we want to use.
sudo apt-get install php7.1
sudo apt-get install php7.1-cli php7.1-common php7.1-curl php7.1-gd php7.1-json php7.1-mbstring php7.1-mysql php7.1-opcache php7.1-readline php7.1-xml
To verify PHP7.1 is installed, just run the following to see the version you are using.