Enabling PDO w/ MySQL extension on CentOS

I have a server running CentOS with PHP 5.2 and I’m trying to figure out how to enable PDO with the MySQL extension. I had thought PDO always came enabled with 5.2, but that apparently isn’t so with this box. I am only familiar with Ubuntu/Debian, and am not sure how things are done on CentOs. Any ideas?

CentOS is Red Hat Enterprise Linux with the branding removed.

RHEL does not officially support PHP 5.2 yet, so its package manager (yum) won’t have any packages designed for 5.2 on it.

There’s a good repository for PHP 5.2 modules/extensions compiled for CentOS that I use. First run this to download it so you can use it in yum:

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
rpm -Uvh remi-release-5*.rpm epel-release-5*.rpm

Now you can install PDO with yum:

yum --enablerepo=remi install php-pdo

And also the MySQL libraries for 5.2 (including pdo_mysql.so)

yum --enablerepo=remi install php-mysql