Centos7 升级PHP版本到5.6

in LinuxPHP with 5 comments

据说Centos是比较追求稳定的版本,它上面所有yum源的软件版本都是比较靠后的。所以当有些项目需要新版软件的时候,就需要手动更新了。

这是一个项目的报错

This version of ownCloud requires at least PHP 5.6.0
You are currently running 5.4.16. Please update your PHP version.

我是打算从5.4的版本升级到5.6,其实升级其他版本也一样,可以执行yum list | grep php查看所有可安装的版本。

下面来讲一下如何升级

  1. 进入终端后查看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  
  1. 执行下面的命令升级软件仓库
 rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm  
 rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm  
  1. 执行下面的命令删除php
yum remove php-common  
然后像安装那样问你是否继续的,输入yes即可  
  1. 清除一下缓存
yum clean all
  1. 安装php 5.6版本(php56w-devel这个不是必需的)
yum install -y php56w php56w-fpm php56w-opcache php56w-xml php56w-mcrypt php56w-gd php56w-devel php56w-mysql php56w-intl php56w-mbstring php56w-cli php56w-common php56w-pdo
  1. 重启httpd
service httpd restart  
#查看最新的版本  
php -v  
#现在应该是5.6了!  
Responses
  1. I think everything posted waѕ verу logical. Ꮋowever, what aƅout
    tһis? suppoe you ɑdded a ⅼittle infⲟrmation? I mean, I
    don't want to tepl you how tօ run yoսr blog, һowever wһɑt іf
    үou aɗded a post title that makes people dessire mⲟre?
    I mean Centos7 升级PHP版本到5.6 - ByG 先生 іs a little vanilla.
    Yοu coսld glance att Yahoo'ѕ front page and notе how they creɑte post headlines tоo gеt
    vidwers intеrested. You mіght try adding ɑ video or ɑ rеlated picture
    օr twо to grab readers excited abߋut what you've written. Just my opinion,
    it couⅼd mske your posts a little livelier.

    Reply
    1. @youjizz porn

      好的,我会考虑,Centos7 upgrades PHPv5.3 or earlier to PHPv5.6

      Reply
  2. Since the admin of this web site is working, no question very rapidly it
    will be well-known, due to its quality contents.

    Reply
  3. I really love your blog.. Pleasant colors
    & theme. Did you make this site yourself? Please reply back as I'm hoping to create my own personal website and would love to know
    where you got this from or exactly what the
    theme is named. Appreciate it!

    Reply