在CentOS 5.6里,默认yum源安装的是php 5.1.6的包,yum安装php以后查看:
rpm -qa php
php-5.1.6-23.2.el5_3
由于有的程序需要使用php5.2以上的版本(打开网站会提示require php >5.2.0!类似的),但Zend Optimizer最高只支持php5.2。
下边介绍的是一个额外的源,结果是正确的:
# rpm --import http://yum.jasonlitka.com/RPM-GPG-KEY-jlitka
# vi /etc/yum.repos.d/utterramblings.repo
或者直接修改/etc/yum.repos.d/utterramblings.repo 名字可以自己定义要以.repo结尾如abc.repo
在打开的文件中加入以下内容:
[abc]
name=Jason’s Utter Ramblings Repo
baseurl=http://www.jasonlitka.com/media/EL$releasever/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka
执行yum update php 如图所示 ,
# yum update php
Loaded plugins: rhnplugin, security
This system is not registered with RHN.
RHN support will be disabled.
utterramblings | 951 B 00:00
utterramblings/primary | 39 kB 00:03
utterramblings 140/140
Skipping security plugin, no data
Setting up Update Process
Resolving Dependencies
Skipping security plugin, no data
–> Running transaction check
–> Processing Dependency: php = 5.1.6-23.2.el5_3 for package: php-devel
—> Package php.i386 0:5.2.16-jason.1 set to be updated
–> Processing Dependency: php-common = 5.2.16-jason.1 for package: php
–> Processing Dependency: php-cli = 5.2.16-jason.1 for package: php
–> Running transaction check
—> Package php-cli.i386 0:5.2.16-jason.1 set to be updated
。。。。。。。。
已经有新的php包尅更新
================================================================================
Package Arch Version Repository Size
================================================================================
Updating:
php i386 5.2.16-jason.1 abc 3.6 M
Installing for dependencies:
mysqlclient15 i386 5.0.91-1.jason.1 abc 2.0 M
Updating for dependencies:
mysql i386 5.1.52-jason.1 abc 3.5 M
mysql-bench i386 5.1.52-jason.1 abc 502 k
mysql-devel i386 5.1.52-jason.1 abc 120 k
mysql-server i386 5.1.52-jason.1 abc 13 M
mysql-test i386 5.1.52-jason.1 abc 7.3 M
php-bcmath i386 5.2.16-jason.1 abc 67 k
php-cli i386 5.2.16-jason.1 abc 2.6 M
php-common i386 5.2.16-jason.1 abc 513 k
php-dba i386 5.2.16-jason.1 abc 127 k
php-devel i386 5.2.16-jason.1 abc 557 k
php-gd i386 5.2.16-jason.1 abc 331 k
php-imap i386 5.2.16-jason.1 abc 108 k
php-ldap i386 5.2.16-jason.1 abc 59 k
php-mbstring i386 5.2.16-jason.1 abc 1.3 M
php-mysql i386 5.2.16-jason.1 abc 267 k
php-ncurses i386 5.2.16-jason.1 abc 78 k
php-odbc i386 5.2.16-jason.1 abc 116 k
php-pdo i386 5.2.16-jason.1 abc 164 k
php-pgsql i386 5.2.16-jason.1 abc 159 k
php-snmp i386 5.2.16-jason.1 abc 44 k
php-soap i386 5.2.16-jason.1 abc 352 k
php-xml i386 5.2.16-jason.1 abc 328 k
php-xmlrpc i386 5.2.16-jason.1 abc 136 k
Transaction Summary
================================================================================
Install 1 Package(s)
Update 24 Package(s)
Remove 0 Package(s)
Total download size: 37 M
Is this ok [y/N]: y
安装 后 重启apache
查看php 目前安装版本
# rpm -qa php
php-5.2.16-jason.1
安装已经完成 还可以使用php -m 查看php支持的模块
如]# php -m | grep mysql
mysql
mysqli
pdo_mysql