locked
php pdo drivers won't load on Windows Server 2008 using IIS Fast-CGI RRS feed

  • Question

  • User-575767516 posted

    I'm not positive where this goes because I'm not 100% certain what is causing this fail.  I've been working on this issue for weeks now and I'm certain I've become notorious in forums at this point.

    Background: I'm attempting to run a php based application that should connect to a database on a Windows Server (2008) through IIS using FastCGI module. The database works great and I was able to get php to work but when I go to pull data from the database using the application I get "could not find driver 1".

    All of my other php code works fine, it's just when I call pdo.

    I've only been able to find a few posts regarding this issue most of them were solved by installing MS Visual Studio.  So I installed that, reset the IIS then tried resetting the server.  Still no dice.

    I have these extensions uncommented in php.ini

    PHP.INI (uncommented extensions)
    xtension=php_bz2.dll
    extension=php_mysql.dll
    extension=php_mysqli.dll
    extension=php_pdo_mysql.dll
    extension=php_pdo_odbc.dll
    extension=php_pdo_sqlite.dll
    extension=php_sqlsrv_55_nts.dll
    extension=php_pdo_sqlsrv_55_nts.dll

    all of these .dll files have been included in my php/ext folder

    I've also read a few how-tos and forums on the Microsoft site and have made sure that the following is set up in my php.ini file:

    open_basedir = "C:/inetpub/wwwroot/;C:/Inetpub/temp;C:/WINDOWS/TEMP/"
    extension_dir = "./ext"
    cgi.force_redirect = 0
    cgi.fix_pathinfo=1
    fastcgi.impersonate = 1
    fastcgi.logging = 0

    I have a copy of php.ini in the PHP folder and an exact copy in the Windows folder as well since "Configuration File (php.ini) Path" is "C:\Windows".

    In PHPInfo()

    Server API = CGI/FastCGI
    PHP Extension Build = API20131226,NTS,VC11
    PHP Version = 5.6.4
    upload_tmp_dir shows the correct extensions that should be loaded
    PDO drivers = "No Value"

    I don't understand why PDO drivers shows up as not found.

    On the IIS Manager I have PHP - FastCGI set up in Handler Mappings according to the Microsoft How-To.  Should I be using CGI module rather than FastCGI or am I missing something?

    I also don't see PHP in the registry under HKEY_LOCAL_MACHINE/SOFTWARE.  I've read that tells Windows where to look for the php.ini file but I'm not sure what that is supposed to look like so I don't want to try to build it manually and mess something up.

    I did, however, add the php folder to the environment variables in Path, so I'm not sure if the lack of PHP directory in the HKEY_LOCAL_MACHINE/SOFTWARE is the problem or not.

    Friday, January 30, 2015 10:07 AM

All replies

  • User-575767516 posted

    I can't immagine the missing or possibly misplaced registry entry is the problem considering that I can run phpinfo() and it pulls the ini file and all of my other php code works except for the code that calls the pdo driver.

    Friday, January 30, 2015 10:42 AM
  • User-575767516 posted

    I tried using mysqli instead of creating a pdo... mysqli is now giving me

    "Fatal error: Class 'mysqli' not found in C:\inetpub\wwwroot\ect.ect"

    And yet, I have the .dll in PHP/ext and it's uncommented in php.ini

    Friday, January 30, 2015 6:04 PM
  • User-2064283741 posted

    have a look here:

    http://www.iis-aid.com/articles/how_to_guides/working_pdo_extensions_iis

    maybe you need:

    extension=php_pdo.dll

    Friday, January 30, 2015 6:19 PM
  • User-575767516 posted

    Thanks a ton!  "extension=php_pdo.dll" was not in the php.ini file so I wrote it in.  Now it's just a matter of finding the driver itself.  It doesn't seem to exist on the php website nor does it exist in the Microsoft driver downoads (I'm probably just looking in the wrong place).  It looks like that is an extension that should come with php?

    I did a google search but those sites that claim to have it all look fishy.

    Saturday, January 31, 2015 5:50 PM
  • User-575767516 posted

    I tried installing older versions.  PHP 5.4 and PHP 5.5. (that's all that is available on the PHP website).

    None of the installations of PHP come with php_pdo.

    I do have php_pdo_sqlsrv_54_nts

    I read on a forum that php_pdo is not a driver but a library, so given that it doesn't show up at all after PHP 5.4 I'm assuming that the classes that were contained in that file were moved.  I can't imagine that the developers would have left an important library out of 3 consecutive "stable" builds.  The forum recommended using an older version of PHP but those didn't work either.

    I'm pretty much at the end of the rope with PHP at this point.  I can't for the life of me figure out why it won't read specifically this one driver.  I'm going to bite the bullet and redo this application in C#.  I don't have enough time on this project to keep banging my head on this.

    Tuesday, February 3, 2015 10:37 AM