标签归档:PHP

升级CentOS中PHP到5.2.x

在VPS上有个wordpress站点需要升级到最新版,而VPS的LNMP环境尚停留在PHP5.1,未满足WP3.2版需运行在PHP5.2以上的要求。而系统CentOS也没有提供官方正式更新,想直接用yum更新遇到困难。于是Google之,经实践后顺利有效,总结步骤,备忘之用。

1. 编辑CentOS-Base.repo文件。

vim /etc/yum.repos.d/CentOS-Base.repo

2. 添加以下代码在CentOS-Base.repo文件的最后:

[c5-testing]
name=CentOS-5 Testing
baseurl=http://dev.centos.org/centos/$releasever/testing/$basearch/
enabled=0
gpgcheck=1
gpgkey=http://dev.centos.org/centos/RPM-GPG-KEY-CentOS-testing

# CentOS-Testing:
# !!!! CAUTION !!!!
# This repository is a proving grounds for packages on their way to CentOSPlus and CentOS Extras.
# They may or may not replace core CentOS packages, and are not guaranteed to function properly.
# These packages build and install, but are waiting for feedback from testers as to
# functionality and stability. Packages in this repository will come and go during the
# development period, so it should not be left enabled or used on production systems without due
# consideration.

3. 检查需要更新的PHP相关组件列表。

yum –disablerepo=* –enablerepo=c5-testing check-update php*

4. 如果列出来的结果没有问题,则开始进行更新。

yum –disablerepo=* –enablerepo=c5-testing update php*

5. 更新安装完成之后,服务器端检查PHP版本。

php -v

6. 重启服务。

/etc/init.d/php-fastcgi restart
service nginx restart

之后即可正常用wordpress内置的update升级程序到最新版本了。

更多关于CentOS 5.x升级自带PHP 5.1.x到PHP 5.2.x的信息,也可以参考CentOS官方Wiki中的相关文档