CentOS升级PHP 5.2.x

2011年5月2日 由 Arslan 发表在技术开发 回复 »

因为有些PHP程序需要 PHP 5.2.x 或更新的版本才能运行。然而前面介绍的在VPS的CentOS环境下迅速安装LAMP方法中,只能是PHP 5.1.x。网上提供的某个通过yum方法快速升级,却导致MySQL数据库连接问题。现在提供另外一个CentOS 软体套件库 – CentOS-Testing,来取得软体包进行升级。这个软体套件库是CentOS团队用来测试新的或者改进过的软体包,然后才将测试过的软体包放进他们的正式官方发行管道,所以这个软体包都不被正式支持,也不保证会运作正常。使用它们时请小心谨慎。

要使用 CentOS-Testing 软体套件库,必须先把它加入到 YUM 的软体套件库设置内。

编辑 /etc/yum.repos.d/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.

请不要在设置里把这个软体套件库启用。当你想从该软体套件库取得软体包时,在指令内启用即可。现在让我们先检查看看这个软体套件库里有什么与 PHP 有关的升级包。在命令行界面输入已下的命令:

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

命令内的选项告诉 YUM 把所有的软体套件库都停用,只使用 c5-testing,并且检查任何名字是以 php 开头的升级包。你会看见一份与 PHP 有关的套件包列表,上面的套件包都是可以用来升级你的 PHP 安装。

Loaded plugins: fastestmirror, priorities
Loading mirror speeds from cached hostfile

php.i386 5.2.9-2.el5.centos c5-testing
php-cli.i386 5.2.9-2.el5.centos c5-testing
php-common.i386 5.2.9-2.el5.centos c5-testing
php-gd.i386 5.2.9-2.el5.centos c5-testing
php-imap.i386 5.2.9-2.el5.centos c5-testing
php-mbstring.i386 5.2.9-2.el5.centos c5-testing
php-mcrypt.i386 5.2.9-2.el5.centos.3 c5-testing
php-mysql.i386 5.2.9-2.el5.centos c5-testing
php-pdo.i386 5.2.9-2.el5.centos c5-testing

查看这份列表。如果那些套件包看起来合理,你就可以进行安装。你必须再次停用其他的软体套件库。

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

然后查看PHP 5.2.x 已经安装在你的 CentOS 上了。

关联文章

  1. 怎样在Linode配置CentOS+LAMP
  2. WordPress换域名以实现301重定向
  3. 【Linux命令】批量删除特征文件
  4. DCCI中国移动互联网报告
  5. 怎样将文本数据导入MySQL
  6. VI命令一览
  7. 方维fanwe团购导航系统
  8. 怎样实现图片防盗链
  9. 便捷更新汉化.PO文件
  10. 免费DNS服务商列表

转载本篇文章必须遵循 知识共享署名 2.5 中国大陆许可协议
原文作者: Arslan
原文标题: CentOS升级PHP 5.2.x
原文链接: http://www.dncase.com/upgrade-to-php-5-2-x-on-centos.html

赞助商