Jump to content

Recommended Posts

Windows 2003 Standard Edition

IIS 6

SQL Server

 

I came into work yesterday to find that we were suddenly having a problem with our PHP scripts connecting to SQL SERVER. Many of these scripts have been in place and working fine for over a year. We found out that there were a few windows update patches that were installed over the weekend. We removed these patches, but we're still having the same problem. I was able to connect using ODBC without any problems, but not using the method below:

 


<?php

//	phpinfo();
//	exit();

$msconnect=mssql_connect("SERVER,1433","user","pass");
$msdb=mssql_select_db("DB",$msconnect);
$msquery = "select TITLE1 from VIEW_CLIENTS2";
$msresults= mssql_query($msquery);
while ($row = mssql_fetch_array($msresults)) {
	echo "Row = " . print_r($row) . "<BR>";
}
?>

 

Here are the results:

 

Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: CMRSQL,1433 in D:\inetpub\wwwroot\testphp2.php on line 6

Warning: mssql_select_db(): supplied argument is not a valid MS SQL-Link resource in D:\inetpub\wwwroot\testphp2.php on line 7

Warning: mssql_query() [function.mssql-query]: Unable to connect to server: (null) in D:\inetpub\wwwroot\testphp2.php on line 9

Warning: mssql_query() [function.mssql-query]: A link to the server could not be established in D:\inetpub\wwwroot\testphp2.php on line 9

Warning: mssql_fetch_array(): supplied argument is not a valid MS SQL-result resource in D:\inetpub\wwwroot\testphp2.php on line 10

 

We have created a test server with the same environment and we're getting the exact same error.

 

Any ideas? Thanks for your help!

Figured it out.

 

I had read several threads about the ntwdblib.dll causing problems, and to replace the file with a different versions. I tried 2 different versions and neither of them worked. We finally found an older version (2000.80.194.0) on a test MSSQL server. We tried this version, and it worked just fine.

 

What we can't understand is why we've been running for several months without problems, and what could have caused the error (Security patches?).

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.