以下為在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
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
c5-testing | 1.9 kB 00:00
c5-testing/primary_db | 502 kB 00:01
Setting up Install Process
Resolving Dependencies
--> Running transaction check
--> Processing Dependency: php = 5.1.6-23.2.el5_3 for package: php-devel
---> Package php.i386 0:5.2.9-2.el5.centos set to be updated
--> Processing Dependency: php-common = 5.2.9-2.el5.centos for package: php
--> Processing Dependency: php-cli = 5.2.9-2.el5.centos for package: php
--> Running transaction check
---> Package php-cli.i386 0:5.2.9-2.el5.centos set to be updated
--> Processing Dependency: php-common = 5.1.6-23.2.el5_3 for package: php-xml
--> Processing Dependency: php-common = 5.1.6-23.2.el5_3 for package: php-gd
--> Processing Dependency: php-common = 5.1.6-23.2.el5_3 for package: php-xmlrpc
--> Processing Dependency: php-common = 5.1.6-23.2.el5_3 for package: php-mbstring
--> Processing Dependency: php-common = 5.1.6-23.2.el5_3 for package: php-ldap
--> Processing Dependency: php-common = 5.1.6-23.2.el5_3 for package: php-pdo
---> Package php-common.i386 0:5.2.9-2.el5.centos set to be updated
---> Package php-devel.i386 0:5.2.9-2.el5.centos set to be updated
--> Running transaction check
---> Package php-gd.i386 0:5.2.9-2.el5.centos set to be updated
---> Package php-ldap.i386 0:5.2.9-2.el5.centos set to be updated
---> Package php-mbstring.i386 0:5.2.9-2.el5.centos set to be updated
---> Package php-pdo.i386 0:5.2.9-2.el5.centos set to be updated
---> Package php-xml.i386 0:5.2.9-2.el5.centos set to be updated
---> Package php-xmlrpc.i386 0:5.2.9-2.el5.centos set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Updating:
php i386 5.2.9-2.el5.centos c5-testing 1.2 M
Updating for dependencies:
php-cli i386 5.2.9-2.el5.centos c5-testing 2.4 M
php-common i386 5.2.9-2.el5.centos c5-testing 237 k
php-devel i386 5.2.9-2.el5.centos c5-testing 547 k
php-gd i386 5.2.9-2.el5.centos c5-testing 112 k
php-ldap i386 5.2.9-2.el5.centos c5-testing 31 k
php-mbstring i386 5.2.9-2.el5.centos c5-testing 1.1 M
php-pdo i386 5.2.9-2.el5.centos c5-testing 62 k
php-xml i386 5.2.9-2.el5.centos c5-testing 97 k
php-xmlrpc i386 5.2.9-2.el5.centos c5-testing 52 k
Transaction Summary
================================================================================
Install 0 Package(s)
Update 10 Package(s)
Remove 0 Package(s)
Total download size: 5.8 M
Is this ok [y/N]: y
Downloading Packages:
(1/10): php-ldap-5.2.9-2.el5.centos.i386.rpm | 31 kB 00:00
(2/10): php-xmlrpc-5.2.9-2.el5.centos.i386.rpm | 52 kB 00:00
(3/10): php-pdo-5.2.9-2.el5.centos.i386.rpm | 62 kB 00:00
(4/10): php-xml-5.2.9-2.el5.centos.i386.rpm | 97 kB 00:00
(5/10): php-gd-5.2.9-2.el5.centos.i386.rpm | 112 kB 00:00
(6/10): php-common-5.2.9-2.el5.centos.i386.rpm | 237 kB 00:01
(7/10): php-devel-5.2.9-2.el5.centos.i386.rpm | 547 kB 00:01
(8/10): php-mbstring-5.2.9-2.el5.centos.i386.rpm | 1.1 MB 00:02
(9/10): php-5.2.9-2.el5.centos.i386.rpm | 1.2 MB 00:02
(10/10): php-cli-5.2.9-2.el5.centos.i386.rpm | 2.4 MB 00:03
--------------------------------------------------------------------------------
Total 348 kB/s | 5.8 MB 00:16
warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID 7203f491
c5-testing/gpgkey | 1.8 kB 00:00
Importing GPG key 0x7203F491 "CentOS-testing (CentOS Developers testing key)
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Updating : php-common 1/20
warning: /etc/php.ini created as /etc/php.ini.rpmnew
Updating : php-cli 2/20
Updating : php 3/20
Updating : php-mbstring 4/20
Updating : php-gd 5/20
Updating : php-xmlrpc 6/20
Updating : php-devel 7/20
Updating : php-xml 8/20
Updating : php-ldap 9/20
Updating : php-pdo 10/20
Cleanup : php-common 11/20
Cleanup : php-mbstring 12/20
Cleanup : php-gd 13/20
Cleanup : php-xmlrpc 14/20
Cleanup : php 15/20
Cleanup : php-devel 16/20
Cleanup : php-xml 17/20
Cleanup : php-ldap 18/20
Cleanup : php-pdo 19/20
Cleanup : php-cli 20/20
Updated:
php.i386 0:5.2.9-2.el5.centos
Dependency Updated:
php-cli.i386 0:5.2.9-2.el5.centos php-common.i386 0:5.2.9-2.el5.centos
php-devel.i386 0:5.2.9-2.el5.centos php-gd.i386 0:5.2.9-2.el5.centos
php-ldap.i386 0:5.2.9-2.el5.centos php-mbstring.i386 0:5.2.9-2.el5.centos
php-pdo.i386 0:5.2.9-2.el5.centos php-xml.i386 0:5.2.9-2.el5.centos
php-xmlrpc.i386 0:5.2.9-2.el5.centos
Complete!
[root@hkvps1 ~]# service httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
[root@hkvps1 ~]# php -v
PHP 5.2.9 (cli) (built: Jul 8 2009 06:03:36)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies
with Zend Optimizer v3.3.9, Copyright (c) 1998-2009, by Zend Technologies
參考來源:http://blog.lilujun.com/post/1208/
0 意見:
張貼留言