我正试图使用PHP远程连接到MSSQL数据库在其他服务器。但最终它显示错误PHP远程访问MSSQL服务器
Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: xxx.xxx.xxx.xxx in xxxxxxx
这里是我的代码
<?php
$myServer = "xxx.xxx.xxx.xxx";
$myUser = "user";
$myPass = "password";
$myDB = "database";
//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");
?>
我尝试使用Microsoft SQL Server Management Studio中的登录名和它可以工作和登录,所以我不认为有问题允许远程连接访问。
Btw ..我只是从XAMPP Localhost访问它。我不确定这个效果与否。
非常感谢您的帮助。
是否安装了扩展?检查你的配置文件 – Akintunde007
你的意思是 - > extension = php_mssql.dll ..是的,它有.. –