Wednesday, March 5, 2008

PHP MS SQL extension connection bug

I found out the hard way that when I installed PHP Eclipse and select MS SQL plugin in the installer, it installs ntwdblib.dll in the same directory as php.exe. This is fine, except that the version that it installs is BUGGY! It doesn't seem to support anything but using Windows Authentication when I try to connect to the database. There is an option in the php.ini that is support to let you change this so that it will use SQL Server logins, but it doesn't use the option, it simply ignores it! When trying to connect to a database using something like: $c = @mssql_connect("mydbserver","sqlUserHere","password", true) It says it cannot connect when I run it from IIS which uses anonymous user. It does work if I use php.exe -f test.php since this process runs as me, and I have access to the database.
That is the general idea of the problem.
Here is what I found.
The version of ntwdblib.dll that is installed by the PHP installer is 2000.2.8.0. The version you need to fix this bug is: 2000.80.194.0. As it turns out MANY people have had the same problem. Read the numerous posts on this here.
This is a good page to use for all problems with the MS SQL PHP extension.
I hope this helps.

No comments: