Centos7 把php5.4升级到php5.6

使用Remi源能够方便对php进行升级(x64版本)php

  • Step1: 添加EPEL和Remi源
wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
 
rpm -Uvh remi-release-7*.rpm epel-release-7*.rpm
  • Step2: 使用Remi repo
vim /etc/yum.repos.d/remi.repo
[remi]
name=Les RPM de remi pour Enterprise Linux 6 - $basearch
#baseurl=http://rpms.famillecollet.com/enterprise/6/remi/$basearch/
mirrorlist=http://rpms.famillecollet.com/enterprise/6/remi/mirror
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
 
[remi-php56]
name=Les RPM de remi de PHP 5.5 pour Enterprise Linux 6 - $basearch
#baseurl=http://rpms.famillecollet.com/enterprise/6/php55/$basearch/
mirrorlist=http://rpms.famillecollet.com/enterprise/6/php55/mirror
# WARNING: If you enable this repository, you must also enable "remi"
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi

把enabled设为1.使之起做用。 注意:若是想吧PHP5.4升级为PHP5.5,则把[remi-php55]的enabled设置为1mysql

  • Step3: 中止相关服务
service httpd stop
service mysqld stop
  • Step4: 更新
yum update -y
yum update php

这个时候会提醒更新php到5.6 经过如下命令查看是否完成升级sql

php -v

而后启动服务apache

service httpd start
service mysqld start

这个时候能够用了。我这边测试apache2和mariadb能正常使用。 注意,存在新的php.conf文件:php.conf.rpmnew。若是须要新文件替代,须要检查好设置内容,避免覆盖。vim

相关文章
相关标签/搜索