jfugate Posted August 14, 2007 Share Posted August 14, 2007 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! Quote Link to comment https://forums.phpfreaks.com/topic/64867-solved-php-connections-to-sql-server-no-longer-working/ Share on other sites More sharing options...
jfugate Posted August 14, 2007 Author Share Posted August 14, 2007 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?). Quote Link to comment https://forums.phpfreaks.com/topic/64867-solved-php-connections-to-sql-server-no-longer-working/#findComment-323990 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.