Home >Backend Development >PHP Tutorial >Warning: mssql_connect() [function.mssql-connect]:_PHP教程
warning: mssql_connect() [function.mssql-connect]:
This is what I did. It is OK to make sure mssql is a normal username and password, but the following does not work.
$con=mssql_connect( "localhost", "sa ", "123456 ") or die ('error');
?>
Error message
warning: mssql_connect() [function.mssql-connect]: unable to connect to server: $sa in d:php2.php on line 11
error
Let’s take a look at my solution,
The system is:
win2003+mssql2000+php5.23
Implementation method
Is there ntwdblib.dll in the php directory? Is there this file? ntwdblib.dll is the customer connection library. If you check the version number, it will usually be 7.0. This can only be connected with mssq 7.0. We are here to If the version of our current database tutorial is the same, copy ntwdblib.dll under mssql to the directory where your php is located and replace the 7.0 one. Restart iis and it will be ok
Interlude, if there is a problem with your mssql connection, you can use PHP's built-in function mssql_get_last_message() to get the error message.