Page

[lamp]centos 配置yum源更新新版php

783Anson16-09-27


centos 配置yum源更新新版php

首先使用rpm -qa|grep php查看系统是否安装了php,我是已经安装了新版的php


[root@VM_160_70_centos /]# rpm -qa|grep php
php55w-common-5.5.38-1.w6.i386
php55w-5.5.38-1.w6.i386
php55w-cli-5.5.38-1.w6.i386


第一、


第二、安装php源,以centos的为例


Centos 5 安装php源:

  rpm -ivh http://mirror.webtatic.com/yum/el5/latest.rpm
  
Centos 6 安装php源:

  rpm -ivh http://mirror.webtatic.com/yum/el6/latest.rpm
  
Centos 7 安装php源和epel扩展源:

rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noar
ch.rpm 
rpm -ivh  
el6.ngx.noarch.rpm (nginx)
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm


安装好之后查看系统yum,看到多了个webtatic的yum

[root@VM_160_70_centos /]# yum repolist
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
 * webtatic: uk.repo.webtatic.com
repo id                                   repo name                                                        status
base                                      CentOS-6 - Base - 163.com                                        5062
epel                                      epel for redhat/centos 6 - i386                                  9836
extras                                    CentOS-6 - Extras - 163.com                                        39
updates                                   CentOS-6 - Updates - 163.com                                      371
webtatic                                  Webtatic Repository EL6 - i386                                    383
repolist: 15691


第三、停止httpd服务,删除原来的php,安装新版php, 55就是代表php5.5


[root@VM_160_70_centos /]# service httpd stop
[root@VM_160_70_centos /]# yum remove php*
[root@VM_160_70_centos /]# yum install php55w

#启动httpd

#使用php -v查看当前php版本


备注:如果web服务器使用的是nginx,则第三步为停止nginx服务,删除php,安装php,启动nginx以及php-fpm

[root@VM_160_70_centos /]# service nginx stop
[root@VM_160_70_centos /]# yum remove php*
[root@VM_160_70_centos /]# yum install php55w
    service php-fpm start    
    service nginx start


来自ansion

2016年9月27日