How to Upgrade PHP version 5.4 to 5.6 on CentOS/RHEL 6/7

Share It!

The PHP Development Team reports the quick accessibility of PHP 5.6.0. This new version accompanies new features, some backward incompatible changes and many enhancements.

logo-php56

Main features include in PHP 5.6.0 :

  • Constant scalar expressions.
  • Exponentiation utilizing the ** operator.
  • Function and constant importing with the utilization decisive word.
  • phpdbg as an intuitive coordinated debugger SAPI.
  • GMP questions now bolster operator over-burdening.
  • Document transfers bigger than 2 gigabytes in size are presently acknowledged.
  • 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
    
  • 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 install -y php56w php56w-opcache php56w-xml php56w-mcrypt php56w-gd php56w-devel php56w-mysql php56w-intl php56w-mbstring
    
  • After installing PHP 5.6, we need to restart Apache service.
    # /etc/init.d/httpd restart
    
    # php -v
    
    PHP 5.6.8 (cli) (built: Apr 17 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.5 on CentOS/RHEL

    Comments
    1. 1 year ago
      • 1 year ago
    2. 1 year ago
      • 1 year ago
        • 1 year ago
          • 1 year ago
            • 1 year ago
            • 1 year ago
    3. 1 year ago
      • 1 year ago
    4. 1 year ago
      • 1 year ago
    5. 9 months ago
      • 7 months ago
    6. 7 months ago
    7. 7 months ago
      • 7 months ago
    8. 6 months ago
      • 6 months ago
        • 3 months ago
          • 3 months ago
    9. 5 months ago
    10. 4 months ago

    Leave a Reply

    Your email address will not be published.