开发者

Upgrade PHP to 5.2.12 on CentOS using yum

开发者 https://www.devze.com 2022-12-19 02:56 出处:网络
I tried to find a simple way to upgrade PHP on my CentOS5 machine using yum instead of downloading the source and compiling it again myself (I did it last time, but it\'s really difficult to get all t

I tried to find a simple way to upgrade PHP on my CentOS5 machine using yum instead of downloading the source and compiling it again myself (I did it last time, but it's really difficult to get all the compile configurations same as CentOS's default). Anyway, I finally use the methods listed here: http://www.a开发者_JS百科tomicorp.com/wiki/index.php/PHP

Now, the command php -v shows the version is already 5.2.11 (which I needed) , but it always contains many warnings like:

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

I think it basically means that I need to recompile these four modules, how could I do that? Any suggestions are appreciated.


This is really easy, you need to add more upto date yum repository and then upgrade.

one example is here.


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

After this you would get latest versions of php and other extensions. It works!!


PHP is not installed all at once, it's modular. So you have things just like you listed that are designed for a different version of PHP. You will need to install all the plugins you are using for your implementation for the version of PHP you have installed.

Short answer, if you want a REALLY up to date PHP version, don't use CentOS. It's just a pain. CentOS is about stability, not cutting edge software. Use Ubuntu or Debian.

Long answer, your best option hands down is to compile from source or to find a repository that provides PHP 5.1.whatyouneed. I would advise against using a repository unless you are VERY sure that it comes from a reputable source.

If I was to do this I'd compile PHP from the source. Here is a link to get you started: http://www.wolflabs.org/2008/12/08/installing-php-from-source-on-centos-x86_64-w-apache/


You should grab the SRPM, replace the tarball, and rebuild it. You may want to grab the "extras" SRPM as well if you need anything from it.


here is repo configuration I've used to upgrade PHP on CentOS 5 (look for Enterprise Linux 5 in the text) http://blog.famillecollet.com/pages/Config-en


Try

pecl install fileinfo readline memcache

And this should fix the problem.


pecl install memcache

Worked for me running Centos 5.5


I followed a CentOS wiki on how to upgrade PHP using a testing repository: http://wiki.centos.org/HowTos/PHP_5.1_To_5.2

I was getting errors for fileinfo and memcache, so I tried:

pecl install fileinfo memcache

...and all of the warnings vanished.

0

精彩评论

暂无评论...
验证码 换一张
取 消