Miscellaneouss

How to Upgrade PHP 5.4 to 5.5 on CentOS/RHEL 5/6/7

PHP ( Hypertext Preprocessor) is a free and open source server-side scripting language. Which is used to generate dynamic web page. PHP contain HTML,Text and script blocks. When user request for a PHP page through web browser than PHP script execute on web server and display the requested result in browser.

PHP 5.5 Features:

  • Included generators and coroutines.
  • Included the at last keyword.
  • Included an improved secret key hashing API.
  • Added support for constant array/string dereferencing.
  • Included scalar class name determination by means of ::class.
  • Included backing for utilizing empty() on the result of function calls and different expressions.
  • Included support for list() builds in for every statements.
  • Included the Zend OPcache extension for opcode reserving.
  • The GD library has been moved up to form 2.1 including new capacities and enhancing existing functionality and so on.

In this article I will show how to upgrade php 5.4 to php 5.5 on CentOS/RHEL 5/6/7 system.

Upgrade PHP 5.4 to 5.5

Follow the steps to upgrade php 5.4 to php 5.5.

1. First we need to check the current version of PHP. To check the versio of PHP run following command:

# php -v
PHP 5.4.35 (cli) (built: Nov 14 2014 07:04:10)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
    with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2015, by Zend Technologies.

2. Include the Webtatic EL yum repository data relating to your CentOS/RHEL variant to yum:

On CentOS/RHEL 7

# rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm
# rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

On CentOS/RHEL 6

# rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm

On CentOS/RHEL 5

# rpm -Uvh http://mirror.webtatic.com/yum/el5/latest.rpm

3. After installing the repository, now remove the old php version. Run the below command to remove the old php and its dependencies packages.

# yum remove php-common

You will get some output like below.

Dependencies Resolved

===================================================================================
 Package             Arch          Version                      Repository    Size
===================================================================================
Removing:
 php-common          x86_64        5.4.39-1.el6.remi            @remi        7.0 M
Removing for dependencies:
 php                 x86_64        5.4.39-1.el6.remi            @remi        9.1 M
 php-cli             x86_64        5.4.39-1.el6.remi            @remi         12 M
 php-devel           x86_64        5.4.39-1.el6.remi            @remi        8.1 M
 php-gd              x86_64        5.4.39-1.el6.remi            @remi        665 k
 php-ldap            x86_64        5.4.39-1.el6.remi            @remi        119 k
 php-mbstring        x86_64        5.4.39-1.el6.remi            @remi        2.5 M
 php-mcrypt          x86_64        5.4.39-1.el6.remi            @remi         86 k
 php-mysql           x86_64        5.4.39-1.el6.remi            @remi        452 k
 php-pdo             x86_64        5.4.39-1.el6.remi            @remi        348 k
 php-pear            noarch        1:1.9.5-9.el6.remi           @remi        2.0 M
 php-process         x86_64        5.4.39-1.el6.remi            @remi        128 k
 php-snmp            x86_64        5.4.39-1.el6.remi            @remi        107 k
 php-xml             x86_64        5.4.39-1.el6.remi            @remi        626 k

Transaction Summary
===================================================================================
Remove       14 Package(s)

Installed size: 43 M

4. Now install PHP 5.5 and php extension using following command.

# yum -y install php55w php55w-opcache
# yum -y install php55w-xml php55w-mcrypt php55w-gd php55w-devel php55w-mysql php55w-intl php55w-mbstring

5. Next restart the apache service after installing PHP 5.5.

# /etc/init.d/httpd restart

6. Verify the PHP version using below command.

# php -v
PHP 5.5.23 (cli) (built: Apr 16 2015 22:49:36)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
    with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2015, by Zend Technologies
Thank you! for visiting LookLinux.

If you find this tutorial helpful please share with your friends to keep it alive. For more helpful topic browse my website www.looklinux.com. To become an author at LookLinux Submit Article. Stay connected to Facebook.

About the author

mm

Santosh Prasad

Hi! I'm Santosh and I'm here to post some cool article for you. If you have any query and suggestion please comment in comment section.

Leave a Comment