Friday, February 13, 2009

Gotcha Of The Day: Installing PHP 5.2 on Cent OS

I wanted to upgrade one of my servers to PHP 5.2.x. But, the standard upgrade command of sudo yum upgrade php wasn't working. Apparently, the default repositories don't have PHP 5.2 versions yet.

Thankfully, there's Google, and articles like this one that outline exactly what you need to do this upgrade.

I ran the steps provided, but when it came time to actually upgrade PHP, I got a whole bunch of errors that looked like:

Transaction Check Error:
file /etc/my.cnf from install of mysql-libs-5.1.31-1.el5.remi conflicts with file from package mysql-5.0.45-7.el5
file /usr/share/mysql/charsets/Index.xml from install of mysql-libs-5.1.31-1.el5.remi conflicts with file from package mysql-5.0.45-7.el5
file /usr/share/mysql/charsets/README from install of mysql-libs-5.1.31-1.el5.remi conflicts with file from package mysql-5.0.45-7.el5
...

And of course, the upgrade didn't happen.

After a bunch of trial and error, I decided I would first attempt to upgrade my version of MySQL and ran:

# Assume these have been run
wget http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-2.noarch.rpm
wget http://rpms.famillecollet.com/el5.i386/remi-release-5-4.el5.remi.noarch.rpm
rpm -Uvh remi-release-5*.rpm epel-release-5*.rpm

# Upgrade MySQL
sudo yum --enablerepo=remi update mysql

Surprisingly, while upgraded MySQL, the new version of PHP was pulled down. The result was an up to date version of MySQL and PHP. Problem solved.

3 comments:

  1. yup adding the Fedora EPEL repository is one of the first things I do when I setup a Centos Box. Also RPMForge (now part of the RPMRepo site) is a good repo to add. Basically you'll get almost any program you want between the two.

    ReplyDelete
  2. Thanks Nick for the suggestion!

    -Ben

    ReplyDelete
  3. Guy, this post saved me! Thankss!!!

    ReplyDelete