How to install PHP 5.6 on CentOS 6.9

To install PHP 5.6 on CentOS 6.9

PHP is a popular general-purpose scripting language mostly used for the web development. Since it is fast, flexible and pragmatic, PHP is capable of powering everything from your blog to the most popular websites in the world. This tutorial covers the installation procedure of PHP 5.6 on CentOS 6.9.

Installation procedure

To start with the installation procedure, add the required repositories by running the following commands.

[root@linuxhelp ~]# rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
Retrieving https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
warning: /var/tmp/rpm-tmp.o8ubzh: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing...                ########################################### [100%]
   1:epel-release           ########################################### [100%]

[root@linuxhelp ~]# rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm
Retrieving https://mirror.webtatic.com/yum/el6/latest.rpm
warning: /var/tmp/rpm-tmp.m52Pqb: Header V4 DSA/SHA1 Signature, key ID cf4c4ff9: NOKEY
Preparing...                ########################################### [100%]
   1:webtatic-release       ########################################### [100%]

After adding your repositories, install PHP 5.6 using yum command and execute it.

[root@linuxhelp ~]# yum install php56w php56w-opcache
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Install Process
Determining fastest mirrors
epel/metalink                                                                                                                                  | 6.2 kB     00:00     
 * base: ftp.iitm.ac.in
 * epel: ftp.jaist.ac.jp
 * extras: ftp.iitm.ac.in
 * updates: ftp.iitm.ac.in
 * webtatic: sp.repo.webtatic.com
base                                                                                                                                           | 3.7 kB     00:00     
epel                                                                                                                                           | 4.3 kB     00:00     
epel/primary_db                                                                                                                                | 5.9 MB     00:00     
extras                                                                                                                                         | 3.4 kB     00:00     
updates                                                                                                                                        | 3.4 kB     00:00     
updates/primary_db                                                                                                                             | 3.6 MB     00:00     
webtatic                                                                                                                                       | 3.6 kB     00:00     
webtatic/primary_db                                                                                                                            | 118 kB     00:00  
.
.
.
.
Installing : php56w-5.6.31-1.w6.x86_64                                                                                                                          3/4 
  Installing : php56w-opcache-5.6.31-1.w6.x86_64                                                                                                                  4/4 
  Verifying  : php56w-cli-5.6.31-1.w6.x86_64                                                                                                                      1/4 
  Verifying  : php56w-opcache-5.6.31-1.w6.x86_64                                                                                                                  2/4 
  Verifying  : php56w-5.6.31-1.w6.x86_64                                                                                                                          3/4 
  Verifying  : php56w-common-5.6.31-1.w6.x86_64                                                                                                                   4/4 

Installed:
  php56w.x86_64 0:5.6.31-1.w6                                                   php56w-opcache.x86_64 0:5.6.31-1.w6                                                  

Dependency Installed:
  php56w-cli.x86_64 0:5.6.31-1.w6                                                  php56w-common.x86_64 0:5.6.31-1.w6                                                 

Complete!

The PHP has been installed successfully. To see the version of the installed PHP. Run the following command.

[root@linuxhelp ~]# php -v
PHP 5.6.31 (cli) (built: Jul  7 2017 06:44: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

To list the modules in PHP, execute the following command as follows.

[root@linuxhelp ~]# php -m
[PHP Modules]
bz2
calendar
Core
ctype
curl
date
ereg
exif
fileinfo
filter
ftp
gettext
gmp
hash
iconv
json
libxml
mhash
openssl
pcntl
pcre
Phar
readline
Reflection
session
shmop
SimpleXML
sockets
SPL
standard
tokenizer
xml
Zend OPcache
zip
zlib

[Zend Modules]
Zend OPcache

Thus the installation procedure of PHP 5.6 on CentOS 6.9 is done without any glitches.

Tag : CentOS Php
FAQ
Q
What is Zend Engine?
A
The Zend Engine is the open source scripting engine that interprets the PHP programming language.
Q
How does PHP compiler work?
A
PHP interpreter works done by the Zend engine. ... The PHP script is loaded into memory by the Zend engine and compiled into Zend opcodes. Opcodes (short for Operation codes) are low-level binary instructions. This opcode is executed and HTML is generated for the same.
Q
Can you tell me the procedure to install PHP 5.6 on Ubuntu?
A
Please refer the link as follow "https://www.linuxhelpbkp.revyy.com/how-to-install-php-5-6-on-centos-6-9/"
Q
Why is PHP an interpreted language?
A
The PHP language is interpreted. The binary that lets you interpret PHP is compiled, but what you write is interpreted. Both. PHP is compiled down to an intermediate bytecode that is then interpreted by the runtime engine.
Q
I have installed PHP without errors, but when I try to start Apache I get undefined symbol errors?
A
# apachectl configtest
This has actually nothing to do with PHP, but with the MySQL client libraries. Some need --with-zlib , others do not. This is also covered in the MySQL FAQ.