mardi 11 octobre 2016

PDO driver cannot be found - IIS, Laravel, Postgres

So I'm trying to access my Postgres DB via PHP with PDO. Whenever I try to use any PDO stuff, I get this thrown:

PDOException in Connector.php line 119:
could not find driver

I've looked around and people have said that I need to uncomment my php.ini file. Here's the section I have in my php.ini file:

[Extension List]
extension=php_mysql.dll
extension=php_mysqli.dll
extension=php_mbstring.dll
extension=php_gd2.dll
extension=php_gettext.dll
extension=php_curl.dll
extension=php_exif.dll
extension=php_xmlrpc.dll
extension=php_openssl.dll
extension=php_soap.dll
extension=php_pgsql.dll
extension=php_pdo_mysql.dll
extension=php_pdo_sqlite.dll
extension=php_pdo_pgsql.dll
extension=php_imap.dll
extension=php_tidy.dll
extension=php_sqlsrv.dll
extension=php_pdo_sqlsrv.dll

The extensions extension=php_pdo_pgsql.dll and extension=php_pgsql.dll are uncommented.

Whenever I look at webpage with phpinfo();, I get:

PDO drivers mysql, sqlite, sqlsrv

So maybe I'm looking at the wrong php.ini file? When I used phpinfo(INFO_GENERAL);, I got:

Loaded Configuration File   C:\Program Files (x86)\php\v5.6\php.ini

Now this is the weird part. When I type php --ini in cmder, I get this:

Configuration File (php.ini) Path: C:\Windows
Loaded Configuration File:         C:\Program Files (x86)\php\v5.6\php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed:      (none)

Okay.. so my php is pulling from the same php.ini file, right? Welp, when I type php -i right after that, I get this:

PDO

PDO support => enabled
PDO drivers => mysql, sqlite, pgsql, sqlsrv

and a little bit down, there's actually a section for the pdo_pgsql extension, whereas there wasn't when I executed phpinfo();.

Additional information:

In IIS, under FastCGI settings, I have this path:

C:\Program Files (x86)\PHP\v5.6\php-cgi.exe

and under Handler Mappings, the request path is *.php, the module is FastCgiModule, and the executable is C:\Program Files (x86)\PHP\v5.6\php-cgi.exe



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire