简体   繁体   English

从PHP对MSSQL连接进行故障排除

[英]Troubleshooting MSSQL Connection from PHP

I'm trying to connect to an external Sql Server through PHP 5.2. 我正在尝试通过PHP 5.2连接到外部Sql Server。

Using this line: 使用此行:

$con = mssql_connect('123.123.123.123','Username','Password') or die('Could not connect to the server!');

I'm receiving this error: 我收到此错误:

Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: 123.123.123.123 in /home/file/public_html/structure/index.php on line 4 Could not connect to the server! 警告:mssql_connect()[function.mssql-connect]:无法连接到服务器:第4行/home/file/public_html/structure/index.php中的123.123.123.123无法连接到服务器!

My hosting provider assures me that ports are open for my server to connect to the DB. 我的托管服务提供商向我保证,我的服务器已打开端口以连接到数据库。 Looking at my php info, MSSQL Support is enabled, using FreeTDS. 查看我的PHP信息,使用FreeTDS启用了MSSQL支持。

Any ideas why this would be failing, or how I can begin trouble shooting the problem? 有什么想法为什么会失败,或者如何开始解决问题?

i know that there is some security for remote connection to MSSQL. 我知道远程连接到MSSQL有一些安全性。 i had a same issue. 我有一个同样的问题。 you need to give connection permition for requested ip. 您需要为请求的IP提供连接许可。

did you try to connect with your personal compter with a MS SQL program. 您是否尝试过使用MS SQL程序与您的个人计算机连接。

if you can so you have problem with your cilent (php host) 如果可以的话,您的cilent(php主机)有问题

if you can not so you have problem with mssql server 如果不能,则您对mssql服务器有问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM