本文介绍了消息“找不到驱动程序"的未捕获异常"PDOException"(到Oracle DB)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在安装Wamp之后,我一直遇到此错误,并且尝试启用php.ini(位于Apache bin文件夹中)中包含的所有PDO.

I've been encountering this error after installing Wamp, and have tried enabling all of the PDO's contained in php.ini (located in the Apache bin folder).

错误是:

PDOException: could not find driver in C:\wamp\www\common_db.php on line 27

第27行是:

$db = new PDO("oci:dbname=".$oraDB, $dbusername, $dbuserpassword);

我已经使用phpinfo()来检查启用了哪些PDO. 我已将php信息上传到Google云端硬盘.

I have used phpinfo () to check which PDO's have been enabled. I've uploaded my php info onto Google Drive.

我正在尝试连接到Oracle数据库,并在php.ini中取消选中php_pdo_oci.dll.但是,这似乎并不能解决丢失的驱动程序错误.

I'm trying to connect to an Oracle database, and have php_pdo_oci.dll unchecked in php.ini. However, this doesn't appear to have resolved the missing driver error.

也许有人知道我可能会缺少什么司机吗?

Might anybody know what driver I could possibly be missing?

推荐答案

除了在PHP配置中启用php_pdo_oci.dll之外,还必须在系统上安装ORACLE驱动程序. PHP扩展只是您的PHP代码与ORACLE驱动程序(即所谓的Instant Client)之间的接口.

As well as enabling php_pdo_oci.dll in your PHP configuration, you also have to have an ORACLE driver installed on your system. The PHP extension is just an interface between your PHP code and the ORACLE driver, or Instant Client as it is called.

因此,根据您使用的ORACLE版本,将取决于您激活的特定扩展名,然后取决于还必须将特定的Instant Client加载到运行Apache和PHP的系统上.

So depending on the Version of ORACLE you are using will depend the specific extension you activate and then the specific Instant Client that you also have to load onto the system running your Apache and PHP.

还必须激活通用

;extension=php_oci.dll

以及其中一个特定的版本扩展名.

And one of the specific version extensions.

;extension=php_oci8.dll      ; Use with Oracle 10gR2 Instant Client
;extension=php_oci8_11g.dll  ; Use with Oracle 11gR2 Instant Client
;extension=php_oci8_12c.dll  ; Use with Oracle Database 12c Instant Client

这篇关于消息“找不到驱动程序"的未捕获异常"PDOException"(到Oracle DB)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-11 03:35