How To Install PHP7 in Ubuntu16.04 LTS?

PHP is not guided by Debain. And not all version of PHP are availeble in Ubuntu Software Center. So how do we download PHP7?

How To Install PHP7 in Ubuntu16.04 LTS?

It is really easy!

For any packages that are not available in official Ubuntu’s repository, we add their package provider repository. In official repository of Ubuntu we only have PHP version 7. In order to download PHP of higher version there is a PPA(Personal Package Archive) provided by Ondrej Sury. We will add the repository and do the php installation.

First, add the repository :

sudo add-apt-repository ppa:ondrej/php

Second, Update your Ubuntu package store :

sudo apt-get update

Third,  Install Install 7.1:

sudo apt-get install php7.1 php7.1-common

Finally after the installation check your PHP version typing PHP -V in your terminal.