4

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.

Recommended method to upgrade PHP 5.1.6 to 5.2.x on CentOS 5.4

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!

solsol
  • 1,121
  • 8
  • 21
  • 31

5 Answers5

9

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.

hobodave
  • 2,840
  • 2
  • 24
  • 34
  • 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
1

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.

Andy
  • 5,230
  • 1
  • 24
  • 34
  • 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
  • do you use it together with CentOS? And doesn't Centos have it's own extra repo's? I can't find ¨PHP in the centosplus or centoscontrib repo's :( – solsol Feb 12 '10 at 19:51
  • 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
  • did you start here http://blog.famillecollet.com/pages/Config-en ? if so, you may need to remove MySQL before upgrading with "yum remove mysql*" HOWEVER I obviously can't be held accountable if something goes wrong! If you are running on production servers, you've never done this before, or you have a hint of self doubt defer to somebody who can do it for you! The best thing to do would be to practice on a VM snapshot :) Any more trouble open a new ticket and link me up, as these comments aren't the best way to dispense advise for future readers! Good luck. – Andy Feb 13 '10 at 14:06
0

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:

DennyHalim.com
  • 491
  • 3
  • 10
0

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.

Embreau
  • 1,287
  • 1
  • 9
  • 10
-1

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

siposa
  • 442
  • 2
  • 3
  • 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 09: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