PHP Connections to MSSQL & ntwdblib.dll

PHP Connections to MSSQL & ntwdblib.dll

Published on: Wednesday, July 29, 2009 12:40:00 PM)

One of the systems within my workplace is a PHP5 application (via Apache on Windows) that uses MySQL5.0 as its main database. However, in addition to this, it has a requirement to an old Microsoft SQL7 Server which was running Windows NT. This machine gave up the ghost and was restored to a SQL2000 machine and it began to work again.

Except from the blasted PHP application mentioned above ! The swine!

So, after digging around and debugging and limiting down the dependencies that it could be, we established that:

Eventually, we happened across a few posts that eluded to the fact that PHP5 ships with a DLL of suckiness.

The difference between the live Apache web server, compared with the development machine was that MSSQL2000 was actually installed on the development one (along with a bunch of other crap). Because this install is in place, it meant that in C:\Windows\System32 was a working and newer copy of ntwdblib.dll .

The bottom line is that the fix is simply to replace the old version of ntwdblib.dll (which comes with PHP5, noted as version: 2000.8.2.0) and replace it with version 2000.80.194.0 Once we started the Apache instances again - BOOM! Amazingness reborn! Our web-servers could see SQL 2000 instances again! Fantastic!