WilliamLou
WilliamLou

Reputation: 1904

Upgrade PHP to 5.2.12 on CentOS using yum

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.atomicorp.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.

Upvotes: 5

Views: 8773

Answers (7)

EGL 2-101
EGL 2-101

Reputation: 1265

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!!

Upvotes: 1

Tristen
Tristen

Reputation: 21

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.

Upvotes: 0

Farrand
Farrand

Reputation: 1

pecl install memcache

Worked for me running Centos 5.5

Upvotes: 0

gvk
gvk

Reputation: 466

Try

pecl install fileinfo readline memcache

And this should fix the problem.

Upvotes: 0

Yaroslav
Yaroslav

Reputation: 2736

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

Upvotes: 0

Ignacio Vazquez-Abrams
Ignacio Vazquez-Abrams

Reputation: 798626

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.

Upvotes: 0

Joe Mills
Joe Mills

Reputation: 1619

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/

Upvotes: 0

Related Questions