带有消息“找不到驱动程序"的PostgreSQL'PDOException' [英] PostgreSql 'PDOException' with message 'could not find driver'

查看:97
本文介绍了带有消息“找不到驱动程序"的PostgreSQL'PDOException'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

pdo在mysql上工作正常,但在与pgsql配合使用时,它给出了错误'PDOException' with message 'could not find driver'我已经安装了php5-pgsql软件包,其中还包括pdo_pgsql

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

此软件包为直接通过PHP脚本进行PostgreSQL数据库连接提供了一个模块.它还包括与PHP数据对象扩展一起使用的pdo_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.

我的dsn是pgsql:dbname=DB;host=192.168.0.2 我正在使用Ubuntu 10.04

my dsn is pgsql:dbname=DB;host=192.168.0.2 I am using Ubuntu 10.04

推荐答案

此消息表示您需要安装和/或激活 PHP中的Postgresql扩展

This message means you need to install and or activate postgresql extension in PHP

此解决方案适用于我: 要安装postgresql 扩展

This solution works for me : To install postgresql extension

[sudo] apt-get install php-pgsql

之后,用于激活它,取消注释etc/php/$PHP_VERSION/apache2/php.ini文件中的pgsqlpdo-pgsql扩展名

after, for activating it, uncomment pgsql and pdo-pgsql extensions in etc/php/$PHP_VERSION/apache2/php.ini file

最后,输入:

[sudo] /etc/init.d/apache2 restart

如果您使用apache(例如我的情况),则要重新启动apache服务器...

To restart apache server if you use apache such as was my case...

这篇关于带有消息“找不到驱动程序"的PostgreSQL'PDOException'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆