PHP connection sqlserver2008, how to connect the database on the specified IP address
$serverName = "(local)"; Database server address
$uid = "sa"; Database user Name
$pwd = "password123"; Database Password
$connectionInfo = Array ("UID" = = $uid, "PWD" = = $pwd, "Database" = "test");
$conn = Sqlsrv_connect ($serverName, $connectionInfo);
if ($conn = = False)
{
echo "Connection failed! ";
Die (Print_r (Sqlsrv_errors (), true));
}
if ($conn) {
echo "Connected successfully";
}
The connection was successful, but how to change the local to 127.0.0.1.
------Solution--------------------
Switch directly to an IP address
------Solution--------------------
$serverName = "IP Address";
Or
$serverName = "Computer name";
If there are multiple instances on the server, you also need to have the instance name
Remote connection also requires remote connection service
SQL attacks are prevalent due to the default remote connection of SQL Server 2000.
So now all learned, without the cumbersome remote connection authorization, is unable to connect