使用yum在CentOS上将PHP升级到5.2.12

时间:2010-02-05 22:33:11

标签: php upgrade centos

我试图找到一种简单的方法来升级我的CentOS5机器上的PHP使用yum而不是下载源并自己再次编译它(我上次做了,但是很难获得所有的编译配置与CentOS的默认值相同)。无论如何,我最后使用这里列出的方法: http://www.atomicorp.com/wiki/index.php/PHP

现在,命令php -v显示版本已经是5.2.11(我需要),但它总是包含许多警告,如:

PHP Warning:  PHP Startup: fileinfo: Unable to initialize   module
Module compiled with module API=20050922, debug=0, thread-safety=0
PHP    compiled with module API=20060613, debug=0, thread-safety=0
These options need to match
in Unknown on line 0

PHP Warning:  PHP Startup: mcrypt: Unable to initialize module
Module compiled with module API=20050922, debug=0, thread-safety=0
PHP    compiled with module API=20060613, debug=0, thread-safety=0
These options need to match
in Unknown on line 0

PHP Warning:  PHP Startup: memcache: Unable to initialize module
Module compiled with module API=20050922, debug=0, thread-safety=0
PHP    compiled with module API=20060613, debug=0, thread-safety=0
These options need to match
in Unknown on line 0

PHP Warning:  PHP Startup: mssql: Unable to initialize module
Module compiled with module API=20050922, debug=0, thread-safety=0
PHP    compiled with module API=20060613, debug=0, thread-safety=0
These options need to match
in Unknown on line 0

我认为这基本上意味着我需要重新编译这四个模块,我怎么能这样做?任何建议都表示赞赏。

7 个答案:

答案 0 :(得分:1)

这非常简单,您需要添加更多最新的yum存储库然后升级。

这里有一个例子。


cat >> /etc/yum.repos.d/utterramblings.repo <<END
[utterramblings]
name=Jason's Utter Ramblings Repo
baseurl=http://www.jasonlitka.com/media/EL5/i386/
enabled=1
gpgcheck=1
gpgkey=http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka

在此之后你会得到最新版本的php和其他扩展。它有效!!

答案 1 :(得分:0)

PHP没有一次全部安装,它是模块化的。所以你有像你列出的那些为不同版本的PHP设计的东西。您需要安装所有用于实现已安装的PHP版本的插件。

简短的回答,如果您想要一个真正的最新PHP版本,请不要使用CentOS。这只是一种痛苦。 CentOS是关于稳定性,而不是尖端软件。使用Ubuntu或Debian。

答案很长,您最好的选择是从源代码编译或找到提供PHP 5.1.whatyouneed的存储库。我建议不要使用存储库,除非你非常确定它来自一个有信誉的来源。

如果我这样做,我会从源代码编译PHP。这是一个帮助您入门的链接:http://www.wolflabs.org/2008/12/08/installing-php-from-source-on-centos-x86_64-w-apache/

答案 2 :(得分:0)

你应该抓住the SRPM,替换tarball,然后重建它。如果您需要任何内容​​,也可以抓住the "extras" SRPM

答案 3 :(得分:0)

这里是我用来升级CentOS 5上的PHP的repo配置(在文中查找Enterprise Linux 5) http://blog.famillecollet.com/pages/Config-en

答案 4 :(得分:0)

尝试

  

pecl install fileinfo readline memcache

这应该可以解决问题。

答案 5 :(得分:0)

pecl install memcache

为我工作运行Centos 5.5

答案 6 :(得分:0)

我关注如何使用测试存储库升级PHP的CentOS wiki: http://wiki.centos.org/HowTos/PHP_5.1_To_5.2

我收到了fileinfo和memcache的错误,所以我尝试了:

pecl install fileinfo memcache

......所有的警告都消失了。