Re: php-pdo

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On Wed, Aug 5, 2009 at 7:18 AM, Alan Sparks<asparks@xxxxxxxxxxxxxxxx> wrote:
> 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@xxxxxxxxxx
>> http://lists.centos.org/mailman/listinfo/centos
>>
> Did you restart Apache after installing the php-pdo package?
> -Alan

Yes I did. I also have the package php-pgsql-5.1.6-3.el4s1.10
installed, which provides the following files:

# rpm -ql php-pgsql
/etc/php.d/pdo_pgsql.ini
/etc/php.d/pgsql.ini
/usr/lib/php/modules/pdo_pgsql.so
/usr/lib/php/modules/pgsql.so

And it should be enabled:

# more /etc/php.d/pdo_pgsql.ini
; Enable pdo_pgsql extension module
extension=pdo_pgsql.so

Reading the php.net manual I get the impression that just loading
these shared libraries should give me the PDO object to play with,
right?

phpinfo() reports me:

Configure Command [...] '--disable-pdo'

additional .ini files parsed 	/etc/php.d/gd.ini, /etc/php.d/ldap.ini,
/etc/php.d/mysql.ini, /etc/php.d/mysqli.ini, /etc/php.d/pdo.ini,
/etc/php.d/pdo_mysql.ini, /etc/php.d/pdo_pgsql.ini,
/etc/php.d/pdo_sqlite.ini, /etc/php.d/pgsql.ini

As the .ini files have been parsed, PDO should be in use, right?
Otherwise PostgreSQL and MySQL work from PHP ok.

Regards,
Peter
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos


[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux