Janus Bahs Jacquet
New Pleskian
Since some time between Tuesday afternoon (7 May) and Wednesday morning (8 May), European time, all attempts to connect to our SQL Server database through PHP (specifically PDO) fail with the following error message:
We have both an SQL Server database and a MySQL database running, and both are accessed from both PHP and Classic ASP (VBScript). Of these four constellations, only PHP connecting to the SQL Server database fails; the other three combinations work as they always have.
I can see from the Plesk changelog that a few seemingly relevant component updates were rolled out on 8 May, the day when we first saw the problem. I don’t actually know if any of these are related to the issue or not, but the fact that we’re suddenly getting error messages related to PHP’s connection via ODBC to an SQL Server database the same day that these exact three components are updated smells fishy. The updates in question are:
When I check the ODBC (64-bit) drivers on the server, I get this:
It looks to me like there are three different ODBC drivers for SQL Server installed; I don’t know how to figure out which is being used with PDO to connect to SQL Server. Version 173.01.01 is, I take it, version 17.3.1.1, so that does seem to have been updated – I don’t know what version we had before. phpinfo() informed me that pdo_sqlsrv was version 5.2.0+10712, but that turned out to be because it was using the 32-bit extension, rather than the 64-bit extension (probably a manual error by me originally). After switching to the 64-bit version, pdo_sqlsrv is now version 5.6.1+11919, which fits with the changelog – but the connection error remains.
If ODBC Driver 13 was supposed to have been removed in the update, though, it clearly wasn’t, as the screenshot shows – but what exactly does “from the default set of components” mean anyway? Does that affect existing installs?
I’ve been researching and trying to find some kind of idea about what’s actually causing the SQLSTATE error, and the closest thing I’ve found is this GitHub issue from January, which seems to deal with a similar issue. The suggested fix there is to uninstall all previous versions of ODBC and install only the most recent one (17.2 in that issue, 17.3 now), but I can’t tell if that includes versions 11 and 13. At any rate, our msodbcsql17.dll file on the server is dated to 14 February, so I suspect this is perhaps not the cause of the current issue.
Apart from that one GitHub issue, I’ve come up completely empty-handed. I’ve been banging my head against the Internet wall all day, and I’ve nothing to show for it but a headache and an ended tether.
Can someone help me troubleshoot this? Am I barking up the wrong tree with the Plesk update? Might it be something else? Halp!
SQLSTATE[IM004]: [Microsoft][ODBC Driver Manager] Driver's SQLAllocHandle on SQL_HANDLE_ENV failed
We have both an SQL Server database and a MySQL database running, and both are accessed from both PHP and Classic ASP (VBScript). Of these four constellations, only PHP connecting to the SQL Server database fails; the other three combinations work as they always have.
I can see from the Plesk changelog that a few seemingly relevant component updates were rolled out on 8 May, the day when we first saw the problem. I don’t actually know if any of these are related to the issue or not, but the fact that we’re suddenly getting error messages related to PHP’s connection via ODBC to an SQL Server database the same day that these exact three components are updated smells fishy. The updates in question are:
- Updated PHP 7.1 to version 7.1.29.
- Updated Microsoft ODBC Driver 17 for SQL Server to version 17.3.1.1.
- Removed Microsoft ODBC Driver 13 for SQL Server from the default set of components.
- Updated Microsoft Drivers for PHP 7.1/7.2 for SQL Server to version 5.6.1.
When I check the ODBC (64-bit) drivers on the server, I get this:
It looks to me like there are three different ODBC drivers for SQL Server installed; I don’t know how to figure out which is being used with PDO to connect to SQL Server. Version 173.01.01 is, I take it, version 17.3.1.1, so that does seem to have been updated – I don’t know what version we had before. phpinfo() informed me that pdo_sqlsrv was version 5.2.0+10712, but that turned out to be because it was using the 32-bit extension, rather than the 64-bit extension (probably a manual error by me originally). After switching to the 64-bit version, pdo_sqlsrv is now version 5.6.1+11919, which fits with the changelog – but the connection error remains.
If ODBC Driver 13 was supposed to have been removed in the update, though, it clearly wasn’t, as the screenshot shows – but what exactly does “from the default set of components” mean anyway? Does that affect existing installs?
I’ve been researching and trying to find some kind of idea about what’s actually causing the SQLSTATE error, and the closest thing I’ve found is this GitHub issue from January, which seems to deal with a similar issue. The suggested fix there is to uninstall all previous versions of ODBC and install only the most recent one (17.2 in that issue, 17.3 now), but I can’t tell if that includes versions 11 and 13. At any rate, our msodbcsql17.dll file on the server is dated to 14 February, so I suspect this is perhaps not the cause of the current issue.
Apart from that one GitHub issue, I’ve come up completely empty-handed. I’ve been banging my head against the Internet wall all day, and I’ve nothing to show for it but a headache and an ended tether.
Can someone help me troubleshoot this? Am I barking up the wrong tree with the Plesk update? Might it be something else? Halp!