Uncaught exception 'PDOException' with message 'could not find driver' (to an Oracle DB)

拟墨画扇 提交于 2019-12-12 01:58:25

问题


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).

The error is:

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

Where line 27 is:

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

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

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?


回答1:


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.

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.

Also you have to activate the generic

;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


来源:https://stackoverflow.com/questions/26796850/uncaught-exception-pdoexception-with-message-could-not-find-driver-to-an-or

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!