由於CentOS默認yum安裝php的版本是5.1.6,使用yum update命令不能升級php到最新版本。並且PHP在5.2之前都有個小小的錯誤,升級到最新版的PHP是非常有必要的。
以下為在CentOS5.4用yum安裝PHP5.2.9的步驟。首先在/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


保存此文件,執行yum --disablerepo=\* --enablerepo=c5-testing install php 接著根據提示Y同意執行,另外如果裝有ZEND,則根據實際情況是否需要修改zend在php.ini和選擇正確對應的ZendOptimizer.so ,然後再執行service httpd restart 重啟Apache。最後輸入php -v 檢查是否已經升級成功。
以下為在ssh輸入及顯示的過程:


[root@hkvps1 ~]# yum --disablerepo=\* --enablerepo=c5-testing install php

arrow
arrow
    文章標籤
    CentOS php5.2 網頁語言
    全站熱搜

    WJH 發表在 痞客邦 留言(0) 人氣()