zoukankan      html  css  js  c++  java
  • 如何在CentOS上升级php5.4至5.6?

    如何在CentOS上升级php5.4至5.6?

    如何在CentOS上升级php5.4至5.6?

    由于CentOS的默认的php安装源版本都是5.4以下的,如果你的项目对php版本有要求或者想升级折腾的可以参考此文升级方法,新项目新环境个人更推荐使用更牛x地php7

    了解php5.6的新特性可参考:

    PHP5.6 New Features:http://php.net/manual/en/migration56.new-features.php
    PHP5.6正式版新特性、新功能介紹:http://www.arefly.com/php-5-6-new-feature/

    本教程适用的linux发行版CentOS/RHEL 7CentOS/RHEL 6CentOS/RHEL 5,提供PHP5.4升级至PHP5.6的方法。

    首先查看你的php版本:

    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

    安装rpm升级包

    注意:请选择符合你的系统版本的命令

    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

    CentOS/RHEL 6:

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

    CentOS/RHEL 5:

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

    安装完之后我们要删除旧版php模块

    # yum remove php-common
    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

    开始安装PHP5.6

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

    安装完成后重启Apache

    # /etc/init.d/httpd restart

    再次查看php版本

    # 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

    至此,大功告成!

  • 相关阅读:
    Spark ListenerBus 和 MetricsSystem 体系分析
    Scala使用JUnit4单元测试
    Error:java: Compilation failed: internal java compiler error
    Spark 2.2 DataFrame的一些算子操作
    Spark SQL中UDF和UDAF
    Scala基础
    Spark Sql的UDF和UDAF函数
    Kafka笔记整理(二):Kafka Java API使用
    Kafka笔记整理(一)
    【口语英语】小学英语1-6年级听力必备知识汇总,建议收藏!
  • 原文地址:https://www.cnblogs.com/adolfmc/p/11207554.html
Copyright © 2011-2022 走看看