您的位置:首页 > 运维架构 > Linux

转:为 CentOS 升级 PHP 到 5.2.x

2011-05-06 15:53 295 查看
之前一篇文章内提到过,即将来临的 Joomla! 1.6 会需要 PHP 5.2.x 或更新的版本才能作业或甚至安装。最近在计划试用 Joomla! 1.6 Alpha 版,因此必须要做的第一件事就是把目前在测试伺服器上的 PHP 5.1.6 升级到 PHP 5.2.x。但不幸的,我所使用的作业系统 - CentOS 5.3,还没有官方正式提供所需的升级。使得我必须从其他的来源寻求升级包。

在网路上很快地搜寻了一下,找出几个第三方的软体套件库可能含有 PHP 5.2.x。最后选择从一个半官方的 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 有关的升级包。在你的指令壳(command shell)下键入已下的指令:

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 伺服器上了。

http://joomlab15.exonsoft.com/zh-cn/articles/general/83-upgrade-php-to-52x-on-centos
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: