HOW TO UPGRADE PHP VERSION 5.4 TO 5.5 ON CENTOS/RHEL 5/6/7

PHP 5.5.0 has been released. The PHP improvement group is proud to report the immediate accessibility of PHP 5.5.0. This release includes countless of new features and bug fixes.

php 5.5

Features include in PHP 5.5.0 :

  • 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.
  • 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

To upgrade php, first you must include the Webtatic EL yum repository data relating to your CentOS/RHEL variant to yum:

For 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

For CentOS/RHEL 6:

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

For CentOS/RHEL 5:

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

After installing Webtatic yum repository, you have to remove the old version of php-common package. It will also delete it dependencies packages.

# yum remove php-common

Sample Output:

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

Now we install PHP 5.5 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

After installing PHP 5.5, we need to restart Apache service.

# /etc/init.d/httpd restart

After restarting Apache service check PHP version.

# 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

HOW TO UPGRADE PHP VERSION 5.4 TO 5.6 ON CENTOS/RHEL 6/7

Please follow and like us:

About the author

Pradhap

View all posts

Leave a Reply

Your email address will not be published.