[CentOS] php-pdo

Tue Aug 4 21:13:41 UTC 2009
Peter Peltonen <peter.peltonen at gmail.com>

I wish to use PostgreSQL with PHP+PDO. I haven't use PDO before.

I have the php-pdo package installed on my CentOS 4.7 server:

# rpm -qa |grep pdo
php-pdo-5.1.6-3.el4s1.10

Now when I try connect to the PostgeSQL db with this code:

<?php
print "PDO test<br />";
try {
        $db = new
PDO("pgsql:host=192.168.0.180;port=5432;dbname=mydb;user=test;password=test");

} catch(PDOException $e) {
        print "Error : " . $e->getMessage() . "<br/>";
        die();
}
?>

I get no output in the browser, but I see this error in Apache log:

PHP Fatal error:  Class 'PDO' not found in /var/www/html/pdotest.php on line 4

Well, it appears the PDO class is not provided by the php-pdo package:

# rpm -ql php-pdo |less/etc/php.d/pdo.ini
/etc/php.d/pdo_sqlite.ini
/usr/lib/php/modules/pdo.so
/usr/lib/php/modules/pdo_sqlite.so

So, what package does provide it or have I misunderstood something?

Regards,
Peter