php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #42715 Consistent Connection Failed to MSSQL 2000 server
Submitted: 2007-09-19 21:21 UTC Modified: 2013-09-27 03:44 UTC
Votes:3
Avg. Score:4.0 ± 0.8
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: pradeep at value-one dot com Assigned: fmk (profile)
Status: Closed Package: MSSQL related
PHP Version: 5.1.5 OS: Windows 2003
Private report: No CVE-ID: None
 [2007-09-19 21:21 UTC] pradeep at value-one dot com
Description:
------------
I had PHP 5.1.5 with MSSQL 2000 on IIS 6 in Windows 2003 installed and runnning major PHP production application. Everything was working fine except I had updated my running Windows 2003 server with Service Pack 2. After that, I am getting Consistent Connection to MSSQL faileure by PHP. One momemnt folowing PHP script shows 'Could Not Connect To MSSQL' and the very nect moment it got Connected. I am not able to understand this wired behaviour of PHP. I think it is due to BUG in PHP.

<?php
	$mssqlHost = "localhost"; #notice the port
	$mssqlUser = 'sa';
	$mssqlPass = 'password';
	$mssqlDB = 'exdb';
	$s = mssql_connect($mssqlHost,$mssqlUser,$mssqlPass) or die('Could not connect to SQL Server on '.$mssqlHost.' '.'Using '.$mssqlUser.' '.'with password '.$mssqlPass.' '.mssql_get_last_message());
	echo $s;
?>


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-09-20 06:08 UTC] pradeep at value-one dot com
This is also an ADD-ON in this regards. I had search a lot in PHP BUG system and I found one reported issue similar to my submission however it is also slight different. 

It is "http://bugs.php.net/bug.php?id=40034" the last submission by "[30 Jun 6:34pm UTC] jmckinzie at novonics dot com". Instead of this version, in my problem most of time I got disconnection from MSSQL Server.
 [2007-09-22 15:30 UTC] pradeep at value-one dot com
Thanks Jani

I had already implemented PHP 5.2.4 Snapshot of developer build dated 19 September, 5:00PM but I face the same problem. The problem still lying but when I move my database server from this machine to another machine (i.e. Install and restore my MSSQL 2000 databases to different machine) then all works fine with my previous PHP as well as suggested PHP debug build (latest snapshot). 

I am wondering what is the exact cause of problem? if this is PHP bug then why is it not repeating when both Web Server (IIS) and Database Server (MSSQL) are on different machine.

One more question, Is this debug build affect my production application (critical for my enterprise) or Does any debug build have any security vulnerability? I am asking this because right now my application running with suggested Snapshot build.
 [2007-10-02 15:06 UTC] pradeep at value-one dot com
Most ppl from community has told me that the debug builds are not a GOOD CHOICE for production applications (or say mission critical). May I know when this bug been resolved in stable version(s)? In addition, in my previous working I rolled back my all windows 2003 pactches (SP2 and Security Patches) then again SQL Server is able to communicate with PHP while I think all these patches are very essential for my server. What is the HACK? What I had missed or which service or patch creating this problem? I appreciate if someone could work on it.
 [2007-11-30 21:39 UTC] soulax at email dot com
Any updates on this? Im having the same exact symptom.

(Web Server)
OS: Windows 2003
PHP: 5.2.4
WEB SERVER: IIS6

trying to connect to a Windows 2003 box on the LAN running SQL SERVER 2000 via mssql. It works, then doesn't connect, then works, and so on and so forth. It used to work fine, perhaps some windows updates caused this?

I know im using a mish mash of OS's and App's, but it's all i have available via my IT department.
 [2007-12-03 09:50 UTC] pradeep at value-one dot com
Well Soulax I did following to resolve my issues. Hope all these will resolve your issue as well. 

1. Synchronize your server time by any INTERNET time servers. Then restart your server so that time will synchronized between your database server and web server.

2. You need to patch your SQL Server 2000 with latest Service Packs at least SP4.

3. You may require Windows 2003 Service Pack 2 for IIS6 issues.

4. After above patching, restart your server.

5. You need to have Updated MSSQL Client Library which has not shipped with default PHP package. you can download this library from 

http://webzila.com/dll/1/ntwdblib.zip. Replace existing NTWDBLIB.DLL from your PHP folder with downloaded file.

Hope doing all step will work. :-)
 [2013-09-27 03:44 UTC] ssufficool@php.net
-Status: Assigned +Status: Closed
 [2013-09-27 03:44 UTC] ssufficool@php.net
Please try using this snapshot:

  http://snaps.php.net/php5.4-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/

I think we can drop support for SQL Server 2000. It also looks like this was 
related to a server configuration error. Bug closed.
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Sun Jan 23 17:03:35 2022 UTC