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

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. 9 years ago
      • 9 years ago
    2. 9 years ago
      • 9 years ago
        • 9 years ago
          • 9 years ago
            • 9 years ago
            • 9 years ago
    3. 9 years ago
      • 9 years ago
    4. 9 years ago
      • 9 years ago
    5. 8 years ago
      • 8 years ago
    6. 8 years ago
    7. 8 years ago
      • 8 years ago
    8. 8 years ago
      • 8 years ago
        • 8 years ago
          • 8 years ago
    9. 8 years ago
    10. 8 years ago
    11. 7 years ago
    12. 7 years ago
    13. 6 years ago
    14. 6 years ago
    15. 6 years ago
    16. 6 years ago

    Leave a Reply

    Your email address will not be published. Required fields are marked *

    This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

    The reCAPTCHA verification period has expired. Please reload the page.