Please help me, heroes (Problems with PHP connecting to MSSQL)
Environment:
1.MYSQL is installed on centos 5.9,
2. MSSSQL 2005 + WIN7, the version (ntwdblib) installed on WIN7 is also 2005.
Question:
I use PHP to connect to MSSQL. If you can connect to a local one, that’s fine
<?php
$res = mssql_connect(‘127.0.0.1′,’sa’,’123′);
var_dump($res);
?>
If I press the same configuration from another computer, the firewall is also turned off. Related services are also enabled. Even so, the connection is unsuccessful.
Share to:
——Solution——————–
Are your PHP and mssql running on the same machine? If not, does the machine running php have the mssql extension installed? Have you changed the connection IP to the IP of the mssql server?
——Solution——————–
1. Not here The same machine, then servername should be the target machine name or ip + / instance name
2. PHP 5.3 no longer has mssql extension
3. MSSSQL 2005 does not allow remote access by default, you need to open it yourself