From: chris dot clos at lmcu dot org
Operating system: Windows Server 2003
PHP version: 5.2.0
PHP Bug Type: MSSQL related
Bug description: mssql_connect(): Unable to connect to server
Description:
------------
I have PHP 5.1.4 and upgraded to php 5.2.0. Copied my php.ini file over.
I use IIS in Server 2003 (Standard) SP1, connecting to SQL Server 2005
(Standard).
I can no longer do mssql_connects, instead I get an error.
Once I did this I get an error:
PHP Warning: mssql_connect(): Unable to connect to server: x.x.x.x in
C:\db-test.php on line 3
This is the same thing that happens when using it via IIS (using
php5isapi) or the php command line. This does work on a Windows XP SP2
machine just fine. I can reproduce this other Windows Server 2003
machines.
I read from bug Id 39313, and I have tried loading the client tools,
however I do not see anywhere that there is a NETBIOS or a TCP/IP type
setting in SQL Server Management Studio.
After looking long and deep, I found that its the version of ntwdblib.dll
that is provided with php package. I found one that is version
"2000.80.194.0" that fixes it, but the one included is "2000.2.8.0"
Same problem appears to happen with 5.1.4 and this version of dll, I think
this file needs to be updated in the distribution.
Reproduce code:
---------------
<?php
$dbh = mssql_connect('x.x.x.x','user','password');
if($dbh) {
echo "true\r\n";
} else {
echo "fubar\r\n";
}
?>
Expected result:
----------------
I should get "true" printed out.
Actual result:
--------------
Using 5.2.0:
Warning: mssql_connect(): Unable to connect to server: x.x.x.x in
C:\db-test.php on line 3
fubar
Using 5.1.4:
true
--
Edit bug report at http://bugs.php.net/?id=40034&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=40034&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=40034&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=40034&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=40034&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=40034&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=40034&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=40034&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=40034&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=40034&r=support
Expected behavior: http://bugs.php.net/fix.php?id=40034&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=40034&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=40034&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=40034&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=40034&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=40034&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=40034&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=40034&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=40034&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=40034&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=40034&r=mysqlcfg