Posted by : at

Category : web-development   php

To install php 7.1 in ubuntu 16.04. Follow the below steps

you want to install PHP 7.1, the latest stable release of PHP at the time of writing this article, on Ubuntu 16.04, a convenient method is to use the PPA (Personal Package Archives) repository.

First of all, you need to add specified PPA to the system apt repository:

sudo apt-get install -y python-software-properties
sudo add-apt-repository -y ppa:ondrej/php
sudo apt-get update -y

Then you can list all of the available PHP 7.1-related packages for review:

apt-cache pkgnames | grep php7.1

Now install the following dependencies :

sudo apt-get install php7.1 php7.1 php7.1-xml php7.1-xsl php7.1-mbstring php7.1-readline php7.1-zip php7.1-mysql php7.1-phpdbg php7.1-interbase php7.1-sybase php7.1 php7.1-sqlite3 php7.1-tidy php7.1-opcache php7.1-pspell php7.1-json php7.1-xmlrpc php7.1-curl php7.1-ldap php7.1-bz2 php7.1-cgi php7.1-imap php7.1-cli php7.1-dba php7.1-dev php7.1-intl php7.1-fpm php7.1-recode php7.1-odbc php7.1-gmp php7.1-common php7.1-pgsql php7.1-bcmath php7.1-snmp php7.1-soap php7.1-mcrypt php7.1-gd php7.1-enchant libapache2-mod-php7.1 libphp7.1-embed

After the installation, you can confirm that with:

php -v

The output should resemble:

PHP (cli) (built: Jan 5 2018 13:26:45) ( NTS ) Copyright (c) 1997-2017 The PHP Group Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies with Zend OPcache, Copyright (c) 1999-2017, by Zend Technologies

Now you are ready to roll with php7.1 Hope it helps !