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
Peter Peltonen wrote:> 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 > _______________________________________________ > CentOS mailing list > CentOS at centos.org > http://lists.centos.org/mailman/listinfo/centos >Did you restart Apache after installing the php-pdo package? -Alan
On 08/04/2009 10:13 PM, Peter Peltonen wrote:> 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 >on the command line : php -i | less should give you more info on what is going on. also make sure the php.ini in /etc/ is the standard distro one and not something custom. -- Karanbir Singh : http://www.karan.org/ : 2522219 at icq