go to bug id or search bugs for
I've tried using FreeTDS on Windows. With build 5.2.5, the php_mssql driver does not work. I haven't had a chance to investigate what changed in 5.2.5 to make this happen.
I had an application running perfectly using PHP+MSSQL but upon upgrading to 5.2.5 all failed. When I down-graded, the application worked again.
Also, if anyone is wondering, yes, I am using the updated ntwlib, no the default one that comes with PHP. Also, if I use the microsoft SQL Driver ( http://www.microsoft.com/sql/technologies/php/default.mspx ) using 5.2.5, I can connect to SQL Server just fine, so this leads me to believe it's a problem with 5.2.5 in particular.
Also, I am not using the default port of 1433, but I have tried this connection using bot hthe default port of 1433 and the port I set to no avail. But the SQL Driver from MSFT will connect on either port, and when I downgrade it connects on either port fine.
$server = "localhost";
$port = "5356";
$username = 'webapp';
$password = '**********';
$db = 'drupal5';
$con = mssql_connect("$server,$port", $username, $password);
print "<h2>We have a connection!</h2>";
print "<h1>NO CONNECTION TO |$server,$port| $username, $password! ERROR!</h2>";
A screen that says: "We have a connection!"
A screen that says: "NO CONNECTION" with connection information.
Add a Patch
Add a Pull Request
I also forgot to add that this issue has been verified by another independent developer. He had the same issue when trying to move to 5.2.5.
I have the same setup and once I upgraded to 5.2.5, I received the same error. When I downgraded back to 5.2.3, it worked fine. I also used the same php.ini as I had in 5.2.3 and also tried modifying the new php-dist.ini with no avail. I am using the php_mssql.dll driver in conjuction with ntwlib.dll (same as the one described by above). I would agree that there seems to be something different in 5.2.5 that is causing this, although I can't tell what either.
the native mssql_connect() function does not support the use of a port number as part of the first parameter, and if I recall correct that's not supported with FreeTDS either.
If you are using ntwdblib you should install and use the 'Network CLient Library' and configure an alias. The alias will have parameters like protocol, IP address and port number. The alias should be used for the first parameter of mssql_connect()
if you are using FreeTDS you need to configure freetds.conf. In there you can create sections like this
host = localhost
port = 1433
tds version = 7.0
; try domain login = yes
; try server login = no
; nt domain = MYDOMAIN
Use the name in the brackets as the first parameter to mssql_connect.