问题
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