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

We are using Zend Framework and in version 2, php 5.2 will be the minimum requirement. We love CentOS and we'd like to keep using it, but PHP 5.1 just won't do anymore when developing web applications with Zend framework.

I found several links to solutions to upgrade with external repositories.

http://serverfault.com/questions/106801/recommended-method-to-upgrade-php-5-1-6-to-5-2-x-on-centos-5

http://www.webtatic.com/blog/2009/05/installing-php-526-on-centos-5/

http://www.webtatic.com/blog/2009/06/php-530-on-centos-5/

We'd like to see another solution with the use of an "official?" CentOS repository if any is available.

We only need to upgrade PHP, the rest of the CentOS setup is fine the way it is. For us, it's important however to keep the YUM cycle intact using the normal repositories.

So in short: is it even possible to upgrade only PHP by using an external repo or otherwise? While still upgrading all our other packages safely through normal yum usage?

Thanks for your help!

share|improve this question

5 Answers 5

up vote 1 down vote accepted

The excellent Remi has the very latest PHP builds for legacy distros - I upgraded Fedora 6 to PHP 5.3 recently. Once you have installed the key as above, you can install PHP 5.3.1 like so:

yum --enablerepo=remi update php-\*

This will not affect normal upgrade/installation from standard repos, as "remi" is a separate repo and not active except for during this single request.

share|improve this answer
    
thanks, are there any other alternatives? I'd love to know what for example Facebook or other big players do to use a recent PHP version on their servers, or is that a stupid question? –  solsol Feb 10 '10 at 20:25
1  
most distributions stay a lot more current than CentOS, which sticks to older, stable software versions - sometimes this strays over into negligence as some packages are not updated for many moons. I would guess Facebook use RHEL or similar, and build their own repositories. Large hosting providers (Rackspace for example) do the same and provide their own well tested repositories. –  Andy Feb 11 '10 at 11:03
    
thanks a lot! We won't be able to build and maintain our own repo's, maybe you know what repositories with recent php/mysql versions are the most trusted ? –  solsol Feb 12 '10 at 15:02
    
I have remi's repos running in production, however I would advise against yum update as regularly as he updates his repos - get to the version you need and stop, pending security advisories :) –  Andy Feb 12 '10 at 15:50
1  
just tried the remi repo, and I get massive errors when updating PHP to 5.3: Transaction Check Error: file /etc/my.cnf from install of mysql-libs-5.1.43-1.el5.remi.i386 conflicts with file from package mysql- ......... and the list goes on –  solsol Feb 12 '10 at 20:09

I wish I would have seen this question when it was asked. You should be very selective which 3rd party repos you install packages from. Many do not follow packaging best practices and most do not ensure non-conflicting package names. You can easily make a giant mess of your system. I gave the following answer in response to this more recent question.


I highly suggest using the IUS Community Project repositories for upgrading your PHP 5.2, and even PHP 5.3 packages on CentOS 5. These are a set of very well maintained and high quality packages, used by Rackspace and maintained, but not supported by them (unless you're a customer of course).

The install instructions can be a little hard to find if you're new to this. You're looking for the client usage guide on their wiki. I will duplicate the instructions here for ease of use.

[root@linuxbox ~]# wget http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/x86_64/ius-release-1.0-6.ius.el5.noarch.rpm 

[root@linuxbox ~]# wget http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/x86_64/epel-release-1-1.ius.el5.noarch.rpm

[root@linuxbox ~]# rpm -Uvh ius-release*.rpm epel-release*.rpm

This downloads and installs both the EPEL and IUS repos for you.

IUS promises not to use conflicting package names with any of the official repos, including EPEL (this is a great thing), things aren't as simple as yum upgrade php. You will need to first uninstall all of your existing PHP packages, and install the appropriate ones from IUS. Alternatively, you can use the yum-plugin-replace plugin to add a useful "replace" capability to YUM.


Manually

First:

[root@linuxbox ~]# rpm -qa | grep php

[root@linuxbox ~]# yum erase php
  • rpm -qa | grep php lists each installed PHP package. You will use this list to install all the appropriate individual PHP packages from IUS
  • yum erase php command just erases PHP and it's dependent packages

Finally:

[root@linuxbox ~]# yum search php52

[root@linuxbox ~]# yum install php52 php52-common php52-pecl-apc php52-mysql ...
  • yum search php52 lists the available PHP 5.2 packages
  • yum install installs your chosen PHP 5.2 packages. You would use the list you obtained in step one to determine which you needed

yum-plugin-replace

[root@linuxbox ~]# yum install yum-plugin-replace

[root@linuxbox ~]# yum replace php --replace-with php52

This will magically determine which PHP packages to erase, and which matching php52 packages to install for you.

share|improve this answer
    
the ius release file that you linked does not seem to exist anymore, but ius-release-1.0-6.ius.el5.noarch.rpm is there and works –  deadprogrammer Feb 23 '11 at 18:35
    
@dead: Thanks, I updated it :) –  hobodave Feb 23 '11 at 19:29

there're many personal repo for php. just make sure you trust the person managing the repo. also, make sure the person do manage the repo instead of build once and forget about it...

here're alternate ways:

A. atomic repo: http://www.atomicorp.com/wiki/index.php/PHP

B. centos dev/testing repo:

share|improve this answer

There is many way to do it.

The official way to upgrade to a latest version would be the CentOS Developpement repository available at : http://dev.centos.org/centos/5/testing/x86_64/RPMS or by compiling it.

If you absolutely need 5.3 installed by YUM, you will need to go with unsupported repository. The best YUM repository known to me are the following :
RPMForge
ART (Atomic Rocket Turtle)
There is tons of other one maintained by one or two persons that you will find around. Just make sure you only update the php packages.

share|improve this answer

I'm using The Zend Server Community Edition. It has a YUM repository: http://files.zend.com/help/Zend-Server/rpm_installation.htm

share|improve this answer
    
can we use Zend Server on CentOS to only update PHP? Or is it better to install the full server stack? –  solsol Feb 10 '10 at 9:43
    
I'm using it with full install only. Your HTTPD server will be unchanged, it will still come from CentOS' repo. –  siposa Feb 10 '10 at 10:01
    
I see that Zend Server CE does not have security fixes or patches included, is that correct? Is zend server CE better/more security than add e.g. caching ourselves on a native CentOS system? –  solsol Feb 10 '10 at 10:17

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.