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.

Using Yum/CentOS.

The problem is that php 5.1 is already installed and running so

yum update php

dont work!

I looked around the net for a solution but they say to do the above =/

share|improve this question
    
There are a bunch of answers here on serverfault. –  h0tw1r3 Jul 29 '11 at 23:49
    
See: serverfault.com/questions/106801/… –  ewwhite Jul 30 '11 at 0:37
    
You do realise that CentOS has different versions, right? –  womble Jul 30 '11 at 0:44
    
possible duplicate of How do I install php 5.3 on CentOS? –  mattdm Jul 30 '11 at 3:45
    
@codeninja: Please state which CentOS 5 version you are using (5.1? 5.3? 5.6? 6.1?), because that is an important difference. php53 wasn't included with RHEL/CentOS/SL until version 5.6. Many answers say you need third party repositories, but that is no longer necessary. Those answers are now outdated. See my answer below for more information. –  Stefan Lasiewski Jul 30 '11 at 4:05
show 1 more comment

2 Answers

up vote 7 down vote accepted

You'll want to yum install php53. Unfortunately, you will need to remove php (which is php 5.1, see below) first.

php53 is available in CentOS as of CentOS 5.6 and above. It is not available in CentOS 5.5 and previous, unless you go through a third-party repository. That is why many answers on Serverfault tell you to use third party repositories-- that's not necessary anymore.

Note that php53 has many dependencies, so you should consider updating CentOS to the latest CentOS 5.x branch as part of this upgrade (which is CentOS 5.6 as of this writing). This is a major upgrade of PHP, and RedHat forced it through because they were way behind the times as of RHEL5.5.

Note how the package is named php53, while php is php 5.1:

$ yum info php53
Available Packages
Name       : php53
Arch       : x86_64
Version    : 5.3.3
Release    : 1.el5_6.1
Size       : 1.3 M
Repo       : updates
Summary    : PHP scripting language for creating dynamic web sites
URL        : http://www.php.net/
License    : PHP and LGPLv2 and LGPLv2+
Description: PHP is an HTML-embedded scripting language. PHP attempts to make it
           : easy for developers to write dynamically generated webpages. PHP also
           : offers built-in database integration for several commercial and
           : non-commercial database management systems, so writing a
           : database-enabled webpage with PHP is fairly simple. The most common
           : use of PHP coding is probably as a replacement for CGI scripts.
           :
           : The php package contains the module which adds support for the PHP
           : language to Apache HTTP Server.

$ yum info php
Available Packages
Name       : php
Arch       : x86_64
Version    : 5.1.6
Release    : 27.el5_5.3
Size       : 2.3 M
Repo       : base
Summary    : The PHP HTML-embedded scripting language. (PHP: Hypertext Preprocessor)
URL        : http://www.php.net/
License    : The PHP License v3.01
Description: PHP is an HTML-embedded scripting language. PHP attempts to make it
           : easy for developers to write dynamically generated webpages. PHP also
           : offers built-in database integration for several commercial and
           : non-commercial database management systems, so writing a
           : database-enabled webpage with PHP is fairly simple. The most common
           : use of PHP coding is probably as a replacement for CGI scripts.
           :
           : The php package contains the module which adds support for the PHP
           : language to Apache HTTP Server.
share|improve this answer
add comment

You need any additional repo to upgrade php as php 5.3 is not yet included in the CentOS Base Repo. You can use the atomic repo which works for me flawlessly,

wget -q -O - http://www.atomicorp.com/installers/atomic | sh
yum upgrade php
yum -y remove atomic-release*

This will install the atomic repo, upgrade php and then remove the atomic-repo (to make sure that any future system update won't install any additional packages from atomic).

share|improve this answer
    
This is not necessary, and also has some disturbing repercussions. For one, now you've not got an easy source for updates for php, and while php is better than it was for a while there, php is generally something you want to stay on top of security patches for. –  mattdm Jul 30 '11 at 7:23
    
This answer looks very similar to serverfault.com/questions/106801/… . If you cut-n-paste this answer from another answer, please cite the original answer. If this is from the Atomic documentation, then please link to the original documentation. –  Stefan Lasiewski Jul 30 '11 at 15:10
    
@mattdm : it use to work for me without any trouble. Actually the packages are from a well know 3rd party repo. So, if you are aware of any repercussions, please enlighten me. –  SparX Aug 1 '11 at 1:31
1  
@Stefan Lasiewski It is from my personal reference doc and not a cut-n-paste answer. I would have added the source if it was from some other source actually, but it is not. –  SparX Aug 1 '11 at 1:35
    
@Stefanl Thank you for the head-up to centos 5.6 release notes :) –  SparX Aug 1 '11 at 2:08
show 1 more comment

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.