#49288 [Opn->Csd]: mssql_connect: Can't connect to database

From: Date: Tue, 18 Aug 2009 14:48:06 +0000
Subject: #49288 [Opn->Csd]: mssql_connect: Can't connect to database
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-141196@lists.php.net to get a copy of this message
ID: 49288 User updated by: claudio_reis at aeiou dot pt Reported By: claudio_reis at aeiou dot pt -Status: Open +Status: Closed Bug Type: MSSQL related Operating System: Windows Server 2003 PHP Version: 5.2SVN-2009-08-18 (snap) New Comment: I remove the "ntwdblib.dll" from the php directory and it starts to work in both browser and task context Previous Comments: ------------------------------------------------------------------------ [2009-08-18 14:08:44] claudio_reis at aeiou dot pt Description: ------------ The code used to create a connection to a MS SQL database works fine when running under a webserver (IIS 6.0) but fails when running from a command line. I used the same file in both scenarios to be 100% sure. Using the netcap2 tool i found that when running as a command line(or task) it tries to comunicate to the ms sql server using SMB protocol and tries to do a tree connect. The sql server responds with a STATUS_BAD_NETWORK_NAME. Result the connection cannot be done. When running in the webserver context it queries the dns for the server ip then it stablish a connection to the 4414 port(ms-sql-m). Why this strange behaviour? Thanks for your help. Other info that can be usefull PHP VERSION: PHP-5.2.9-2 MS SQL SERVER: SQL Server Enterprise Edition 8.00.2184(SP4) Microsoft Windows NT - 5.0(2195) Windows Server: MS Windows Server 2003 R2 SP2 php.ini: [MSSQL] mssql.allow_persistent = On mssql.max_persistent = -1 mssql.max_links = -1 mssql.min_error_severity = 10 mssql.min_message_severity = 10 mssql.compatability_mode = Off Reproduce code: --------------- /* connection string ommited for security reasons */ if ($con = mssql_connect("SERVER","USER","PASSWORD")){ print("YES");} else{ print("NO")} Expected result: ---------------- YES Actual result: -------------- can't connect to server ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=49288&edit=1

« previous php.bugs (#141196) next »