我有一个带有数据库MSSQL 2008 r2的谷歌vps服务器。在家里的电脑上我无法使用php脚本连接到数据库,但是当填充ip,端口工具" SQL Server Management Studio"它成功连接。请帮助我解决它,我似乎疯了:(
Image SQL Server Management Studio 2008 r2
这是我的PHP代码
<?php
$myserver = "xx.xx.xx.xx,1433";
$myuser = "sa";
$mypass = "123456";
$mydb = "muonline";
//connection to the database
$dbhandle = mssql_connect($myserver, $myuser, $mypass)
or die("couldn't connect to sql server on $myserver");
//select a database to work with
$selected = mssql_select_db($mydb, $dbhandle)
or die("couldn't open database $mydb");
//close the connection
mssql_close($dbhandle);
?>
我尝试使用值
更改$ myserverxx.xx.xx.xx:1433
xx.xx.xx.xx\\instance-1,1433
xx.xx.xx.xx:1433\\instance-1
xx.xx.xx.xx
xx.xx.xx.xx\\instance-1
始终通知警告:mssql_connect()[function.mssql-connect]:无法连接到服务器