3

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?

Stefan Lasiewski
  • 23,667
  • 41
  • 132
  • 186
ewwhite
  • 197,159
  • 92
  • 443
  • 809

4 Answers4

6

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.

Coops
  • 6,055
  • 1
  • 34
  • 54
2

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.

Sirex
  • 5,499
  • 2
  • 33
  • 54
midbeam
  • 21
  • 2
0

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.

Satanicpuppy
  • 5,946
  • 1
  • 17
  • 18
0

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!

Dave Drager
  • 8,375
  • 29
  • 45