Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

It's been awhile since this type of question was asked here. Perhaps the recommended solution has changed.

I have a CentOS 5.4 mail server running RoundCube webmail. By default, RoundCube expects PHP version 5.2 or above. CentOS 5 is stuck at revision 5.1.6 with backports of certain features from 5.2. I disabled the PHP check for Roundcube and it works well. However, one of the plugins I would like to use uses a method introduced in PHP 5.2.

Due to the binding of PHP and Postgres/MySQL in this case, what is the best way to upgrade the PHP version from 5.1.6 to 5.2.x? I've seen 3rd party repos, CentOS testing, Fedora... or I could compile from source. I'd like to keep this system in a stable state so that it doesn't blow apart during the next round of updates.

Any recommendations?

share|improve this question

4 Answers 4

up vote 5 down vote accepted

I've done this many times using the atomic repos. In very simple terms, three steps are all that's needed in most situations:

wget -q -O - http://www.atomicorp.com/installers/atomic.sh | sh
yum update php
service httpd restart

I obviously can't guarrente it will work for you, but for myself this has become the standard method.

share|improve this answer
    
I ended up using this solution. –  ewwhite Jan 27 '10 at 19:09
    
+1 for atomic repos, i use them too. –  GruffTech Jan 27 '10 at 21:56
    
+1. 1 minute job. just works. –  Elzo Valugi Jul 26 '10 at 12:55

I'd say that any of those methods MAY work fine, but you won't know until you try it, so you better make sure your backups are in order. That being said, upgrading php is much easier on Linux than on Windows, and I'd be surprised if you had any problems. Assuming your install is, if not vanilla, at least a common install, you should be fine with a pre-packaged RPM.

It is possible to run different versions of php on the same webserver; unfortunately you can only run one as an Apache module, which leaves you fiddling around with the CGI interface.

The beauty of modern RPM is that you can roll back the install. That will make it a little easier.

On the other hand, if you build from source, you can just build it in a different directory. Then all you have to do is change which mod php apache loads, and change the location of the php.ini file, and you've upgraded without any risk to your current configuration.

share|improve this answer

I believe there a number of solutions, and the one you pick depends on your style of system administration.

The 'easy' way is to install php and related packages from another repository, like this one. The upside is that it takes less time, the downside is that you are trusting an outside source for your binaries on your system, both for timely updates and for maintaining the integrity and security of the packages.

The 'hard' way is to compile your own. I say it is 'hard' but it really is not too bad. What I do is I have the ./configure commands all saved, so when a new release is put out, I simply have to use the same switches to get my php environment the same as it was for prior releases.

For systems without fussy requirements I use the rpm rout (actually 5.1 works fine for those systems), but for those with custom php environments I still compile from source.

Another benefit of compiling php on your own is that you actually understand and learn more about the software and how it works on your server. You can take pride in that and it will set you apart from some other sysadmins!

share|improve this answer

Simply Install Remi repo. And Run:

yum update -y

and wait until the updates have finished, then reboot your VPS using init:

init 6

Now you have successfully updated php on your system.

share|improve this answer
    
Why should anyone reboot? –  Michael Hampton Jul 18 at 11:23

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.