How to Install PHP7 on CentOS7

To Install PHP7 on CentOS 7

The arrival of complete version of PHP 7 a few weeks back has assured its users of new features and much needed optimizations, along with corresponding speed improvements. Installing PHP7 on a CentOS machine is so simple and this article sheds light on it.

Installing PHP 7

In order to install PHP 7 on your computer, you are required to update your system which can be done by using yum update as follows.

[root@linuxhelp1 ~]# yum update

Once your system is updated, you can go ahead and add the required repositories to yum as follows.

[root@linuxhelp1 ~]# rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

Retrieving https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
Preparing...                          ################################# [100%]
Updating / installing...
   1:epel-release-7-10                ################################# [ 50%]
Cleaning up / removing...
   2:epel-release-7-9                 ################################# [100%]

[root@linuxhelp1 ~]# rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
Retrieving https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
warning: /var/tmp/rpm-tmp.UsbRdD: Header V4 RSA/SHA1 Signature, key ID 62e74ca5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:webtatic-release-7-3             ################################# [100%]

Now is the time to install PHP 7, invoke the following command for the same purpose.

[root@linuxhelp1 ~]# yum install php70w
Loaded plugins: fastestmirror, langpacks
webtatic                                                 | 3.6 kB     00:00     
(1/2): webtatic/x86_64/group_gz                            |  448 B   00:00     
(2/2): webtatic/x86_64/primary_db                          | 203 kB   00:02     
Loading mirror speeds from cached hostfile
 * base: mirror.vbctv.in
 * epel: ftp.riken.jp
 * extras: mirror.vbctv.in
 * updates: mirror.vbctv.in
* webtatic: uk.repo.webtatic.com
.
.
.
httpd-tools.x86_64 0:2.4.6-45.el7.centos.4                                    
  mailcap.noarch 0:2.1.41-2.el7                                                 
  php70w-cli.x86_64 0:7.0.20-1.w7                                               
  php70w-common.x86_64 0:7.0.20-1.w7                                            

Complete!

The primary installation is complete, you can also add your desired extensions with the help of following command.

[root@linuxhelp1 ~]# yum install php70w-mysql php70w-xml php70w-soap php70w-xmlrpc -y
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirror.vbctv.in
 * epel: mirror.premi.st
 * extras: mirror.vbctv.in
 * updates: mirror.vbctv.in
 * webtatic: sp.repo.webtatic.com
Resolving Dependencies
-->  Running transaction check
--->  Package php70w-mysql.x86_64 0:7.0.20-1.w7 will be installed
-->  Processing Dependency: php70w-pdo(x86-64) for package: php70w-mysql-7.0.20-1.w7.x86_64
--->  Package php70w-soap.x86_64 0:7.0.20-1.w7 will be installed
--->  Package php70w-xml.x86_64 0:7.0.20-1.w7 will be installed
.
.
.
Installed:
  php70w-mysql.x86_64 0:7.0.20-1.w7      php70w-soap.x86_64 0:7.0.20-1.w7       
  php70w-xml.x86_64 0:7.0.20-1.w7        php70w-xmlrpc.x86_64 0:7.0.20-1.w7     

Dependency Installed:
  php70w-pdo.x86_64 0:7.0.20-1.w7                                               

Complete!

Once done, make sure you check the version of the installed package by running the following command.

[root@linuxhelp1 ~]# php -v
PHP 7.0.20 (cli) (built: Jun 10 2017 06:34:07) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies

That was all, a simple and easy installation process. Enjoy using PHP7 on your CentOS 7 machine.

Tag : CentOS Php
FAQ
Q
What version of PHP is required for PHP Framework on CentOS ?
A
Anything Above php 5 works better for PHP Framework on CentOS.
Q
What happened to the database dump feature in php Admin?
A
You need to configure phpPgAdmin (in the config.inc.php file) to point to the location of the pg_dump and pg_dumpall utilities on your server. Once you have done that, the database export feature will appear.
Q
How do I change the sort ordering of textual data in PostgreSQL?
A
PostgreSQL sorts textual data according to the ordering that is defined by the current locale, which is selected during initdb.
Q
How do I control connections from other hosts?
A
, PostgreSQL only allows connections from the local machine using Unix domain sockets or TCP/IP connections. Other machines will not be able to connect unless you modify listen_addresses in the postgresql.conf file, enable host-based authentication by modifying the $PGDATA/pg_hba.conf file, and restart.
Q
yum install failing continously on centos 7?
A
try the command as follow " yum clean metadata yum clean all"