How to install PHP 7 on CentOS 6.7

How to install PHP 7 on CentOS 6.7

PHP 7 is a fork release of PHP programming language and is touted to be developed and delivered for mobile and the cloud environment. It has improved performance, lower memory consumption, scalar type declarations, and improved exception hierarchy than its predecessors. This tutorial covers the installation procedure of PHP 7 on CentOS 6.7.

Installation procedure

To start the download the epel repo file using RPM by executing the following command.

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

And also download the latest repo file by using RPM and run the following command.

[root@node3 ~]# rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm

Install the PHP package using yum command and press y to continue the installation process.

[root@node3 ~]# yum install php70w php70w-opcache -y

After finishing the installation procedure, install the PHP modules using yum command and press y to continue the installation procedure.

[root@node3 ~]# yum install php70w-mysql php70w-xml php70w-soap php70w-xmlrpc -y

The PHP package and PHP modules are successfully installed in the target system. Check the version of PHP by executing the below command.

[root@node3 ~]# php -v
PHP 7.0.19 (cli) (built: May 12 2017 21:20:16) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.0.19, Copyright (c) 1999-2017, by Zend Technologies

Wasn' t that an easy installation procedure? PHP 7 supports the features of secure random number generator, null coalescing operator and zero cost asserts.

Tag : CentOS Php
FAQ
Q
Does Flywheel offer PHP 7?
A
Yes! PHP 7.1 is standard on all new Flywheel sites and is available with an upgrade for existing sites.
All existing Flywheel sites created before this change will be upgraded to PHP 7 beginning in August 2017.
Q
How to install PHP 5.6 on Centos?
A
Run the following command:
# rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
Q
WHEN CAN I UPGRADE TO A PHP 7 ENVIRONMENT ON WP ENGINE?
A
PHP 7 is now available for all plans on WP Engine. Please read below for important information and instructions on how to get PHP7 at WP Engine.
Q
Installation Of Php 5.6 On Centos?
A
to install php 5.6 on centos 6 # rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm # rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm # yum install php56
Q
How to Check the version of PHP?
A
Run the following command:
# php -v