How To Install PHP 5.6 Using YUM ON CentOS/RHEL 6/7?

PHP  is one the latest version of PHP in IT industry and many modules/ libraries function has been useful in PHP 5.6. This newer version of PHP 5.6.30 was made public CentOS/RHEL. PHP 5.6 got support for PEAR install and pecl has got deprecation so webtatic repository keeps deprecated libraries for support.

Here with the end of this article, we will learn how to install PHP 5.6 on CentOS/RHEL 6.x using YUM from Webtatic repository.

Scenario: My Server IP is 192.168.1.188
OS CentOS: 6.9

Note: If you are a SUDO user then prefix every command with sudo, like #sudo ifconfig

Step1: Install Required repositories

To install PHP 5.6 we require Webtatic EL repository and EPEL repository will be required as a dependency for this repository installation:

CentOS/RHEL 7.x:

rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

CentOS/RHEL 6.x:

rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm

Step 2: Install PHP With Webtatic

After first step 1, you can install PHP 5.6 with a simple command.

#yum install php56w php56w-opcache

Step 3: Look For PHP Modules

As PHP 5.6 is installed but your application may require a various module to process. PHP 5.6 also have a list for a wide variety of useful libraries and modules which you can add to your PHP. If you want to look for available PHP modules type in the following command:

#yum search php56

Output Will be

Loaded plugins: priorities, update-motd, upgrade-helper
9 packages excluded due to repository priority protections
===================================================================================== N/S matched: php56 ======================================================================================
php56-pecl-propro-devel.x86_64 : php56-pecl-propro developer files (header)
php56-pecl-raphf-devel.x86_64 : php56-pecl-raphf developer files (header)
php56-php-pecl-dom-varimport-devel.x86_64 : php56-php-pecl-dom-varimport developer files (header)
php56-php-pecl-judy-devel.x86_64 : php56-php-pecl-judy developer files (header)
php56-php-pecl-pcsc-devel.x86_64 : php56-php-pecl-pcsc developer files (header)
php56-php-pecl-propro-devel.x86_64 : php56-php-pecl-propro developer files (header)
php56-php-pecl-raphf-devel.x86_64 : php56-php-pecl-raphf developer files (header)
php56-php-pecl-xmldiff-devel.x86_64 : php56-php-pecl-xmldiff developer files (header)
php56-runtime.x86_64 : Package that handles php56 Software Collection.
php56-scldevel.x86_64 : Package shipping development files for php56
php56.x86_64 : PHP scripting language for creating dynamic web sites
php56-bcmath.x86_64 : A module for PHP applications for using the bcmath library
php56-build.x86_64 : Package shipping basic build configuration
php56-cli.x86_64 : Command-line interface for PHP
php56-common.x86_64 : Common files for PHP
php56-dba.x86_64 : A database abstraction layer module for PHP applications
php56-dbg.x86_64 : The interactive PHP debugger
php56-devel.x86_64 : Files needed for building PHP extensions
php56-embedded.x86_64 : PHP library for embedding in applications
.....................................
And This is a huge list

Step 4: Install A module

Now as per your production and deployment requirement you can install any module listed. Here we are installing php56w-opcache and php56w-fpm as an example.

#yum install php56-fpm php56w-mysql php56-gd php56-pear php56w-pear php56-mbstring php56-mbstring php56-mcrypt php56w-pecl-redis

Well, Congratulations! You have successfully Installed PHP 5.6.30



 

Step 5: Check Your Installation

As you have successfully installed our custom PHP version, we need to verify its version and location of installation

#which php

Output Window will be like:

/usr/bin/php

Also, check which version of PHP your shell is using:

#php -v

Output Window:

PHP 5.6.30 (cli) (built: Jan 19 2017 22:50:24) 
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
 with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies

Watch Video:

YouTube Link

You may also Like

  1. How To Install PHP using YUM
  2. How To Set Up LAMP Environment With Apache MySql And PHP: Part-1

Watch Video

Source [PHP Site]