pdo is working fine with mysql but with pgsql its giving error 'PDOException' with message 'could not find driver'
I've installed php5-pgsql
package which also includes pdo_pgsql
http://packages.debian.org/sid/php5-pgsql
This package provides a module for PostgreSQL database connections directly from PHP scripts. It also includes the pdo_pgsql module for use with the PHP Data Object extension.
my dsn is pgsql:dbname=DB;host=192.168.0.2
I am using Ubuntu 10.04
This message means you need to install and or activate postgresql extension in PHP
This solution works for me : To install postgresql extension
[sudo] apt-get install php-pgsql
after, for activating it, uncomment pgsql
and pdo-pgsql
extensions in etc/php/$PHP_VERSION/apache2/php.ini
file
Finally, type :
[sudo] /etc/init.d/apache2 restart
To restart apache server if you use apache such as was my case...
1) Have you enabled pgsql.so in php.ini
(extension=pgsql.so
)?
2) Is you Postgresql listenin on 192.168.0.2
interface? (You can check it by netstat -tpln
)
3) How you authenticate your access into Postgresql?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With