Friday 4 June 2010

Installing PHP 5.3 on CentOS 5

Using the 3rd party repository by Remi Collet, which seems to be the most popular 3rd party web repo.

1) Install the repo by following the instructions on his website: http://blog.famillecollet.com/pages/Config (this site is in French, which can be automatically translated if you use Google Chrome!). Note that it depends on the EPEL repo, but the instructions take care of that as well. For me, this meant executing the following commands:
wget http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
sudo rpm-Uvh remi-release-5 *. rpm EPEL-release-5 *. rpm

2) Enable the new repository by setting enabled=1 in this file: /etc/yum.repos.d/remi.repo

3) Upgrade your PHP packages. Optionally you can add the suffix mysql-* to upgrade your mysql packages as well. Note: this will automagically fetch the GPG key for Remi's repo.
sudo yum update php php-*

4) Restart Apache
sudo /etc/init.d/httpd restart

Note: after this I got an error on all pages: "Warning: strtotime(): It is not safe to rely on the system's timezone settings". The solution was to add my timezone to /etc/php.ini i.e. add the line
date.timezone = "Europe/London"
You can find a list of supported timezones here: http://www.php.net/manual/en/timezones.php


References
http://gofedora.com/how-to-install-php-on-centos-red-hat-rhel/

No comments:

Post a Comment