问题描述
pdo 在 mysql 上工作正常,但在 pgsql 中它给出错误 'PDOException' 并显示消息 'could not find driver'
我已经安装了 php5-pgsql
包,它也包括 pdo_pgsql
最后输入:
[sudo]/etc/init.d/apache2 restart
如果你像我这样使用 apache,要重新启动 apache 服务器...
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
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...
这篇关于带有消息“找不到驱动程序"的 PostgreSql“PDOException"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!