Page 1 of 1

MSSQL connection problems

Posted: Thu Apr 08, 2004 12:11 pm
by jrcole
I am running Windows Server 2003 with IIS 6. I installed php using ISAPI, enabled extensions for php to work with IIS. All of my pure php pages work just like they are supposed to. However, I cannot connect to an mssql server. Using exact copies of pages that do work on an XP machine with IIS and PHP as CGI, when attempting the @mssql_connect function, it always bails and displays the die message. When viewing phpinfo, it shows mssql to be installed. Do I need to add anything to IIS for mssql? If so, what? I tried adding an extension of php_mssql.dll, that didnt seem to do anything. Any help would be greatly appreciated.

Posted: Fri Apr 09, 2004 1:57 pm
by dethier
I got this off of here. It mentions 4.3.4 but it works for 4.3.5 as well.

There's a problem with the bundled ntwdblib.dll bundled in the PHP distribution.



Applies to : IIS 5.0, PHP 4.3.4, MS-SQL 2000

If you try to connect to a host with multiple SQL-Server instances, you have to copy the ntwdblib.dll from a MS SQL 2000 installation to the system32 directory of your webserver.

The ntwdblib.dll bundled with php 4.3.4 does not support multpiple server instance.

I used the DLL version 2000.80.194.0 that came with MS SQL Server 8.00.194.

Example:
$dbhost="server_name\instance_name,port_number";
$dbuser="foo";
$dbpass="foo";
$dbname="foo";
$db=mssql_connect($dbhost,$dbuser,$dbpass);
mssql_select_db($dbname,$db);

Hope this helps.

Posted: Fri Apr 09, 2004 2:46 pm
by jrcole
Works perfect. Thanks a bunch dethier.

Seems strange though that I didnt have a problem on my other machine with iis 5.1 and php 4.3.4.4... but i wont question what works.

Thanks again.