SecureCube.com

27Oct/050

mssql_connect problem

Ended up moving a web portal from a PC class machine to a server platform using the same OS, PHP version 5.0.5, and php code. After the move the mssql_connect php function wasn't connecting to the MSSQL server (which hasn't moved). I ended up finding the solution on php's mssql_connect manual page. The following resolved the issue:

1) Open regedit.exe
2) Browse to the key named HKEY_LOCAL_MACHINE\\SOFTWARE \\Microsoft\\MSSQLServer\\Client\\ConnectTo
3) There should be one or more keys in the format "SERVER" = "LIBRARY,SERVER,PORT"
where SERVER is a NetBIOS name, Named Pipe alias or the server's IP address, and PORT is usually 1433.
4) If LIBRARY is set to DBMSSOCN, try changing it to DBNETLIB. That worked for me.
5) Restart IIS

If that doesn't fix the problem or you don't have the "SERVER" key, try the following:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ MSSQLServer\Client\ConnectTo] (strip space)
"DSQUERY"="DBNETLIB"

Filed under: Web Apps No Comments