I am attempting to set up a website on my Windows 10 machine using IIS. I can successfully load a simple php file (using PHP 8.1).
When I attempt a new PDO call to MSAccess I get:
HTTP Error 500.0 - Internal Server Error
C:\php\php-cgi.exe - The FastCGI process exited unexpectedly
My code is
$dbName = $_SERVER["DOCUMENT_ROOT"] . "\\vhs\VHS.accdb";
try {
$db = new PDO("odbc:DRIVER={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=$dbName;Uid=admin;");
}
catch (PDOException $e) {
echo $e->getMessage();
}
Nothing gets placed into the php_errors.log.
I have both
extension=pdo_odbc.dll
extension=php_pdo_odbc.dll
in my php.ini file (and both exist in the ext folder).
I have tried the following:
1 - a different MSAccess database (both another .accdb and an old .mdb) ... same error
2 - using the incorrect driver name (for example "Microsoft Blah Driver") ... this results in a PDOException "SQLSTATE[IM002] SQLDriverConnect: 0 [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified" so I believe I have the driver spelled correctly in my original code
The Microsoft Access Driver (*.mdb, .accdb) name matches the one I see in the 64-bit ODBC administrator. If I instead use Microsoft Access Driver (.mdb) which appears in the 32-bit administrator I get the 'Data source name not found' error as well.
Does anyone have any suggestions for things to check / try?