为什么我的服务器不能使用 PHP mssql_connect 连接到远程 MSSQL 服务器? [英] Why won't my server connect to a remote MSSQL server using PHP mssql_connect?

查看:30
本文介绍了为什么我的服务器不能使用 PHP mssql_connect 连接到远程 MSSQL 服务器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不得不将我们为客户端编写的应用程序移至新服务器,而我使用 PHP mssql_connect 启动的远程连接已停止工作.我注意到 PHP 不是用 mssql 编译的,所以我要求服务器管理员安装它.我可以验证它现在是通过 PHP 信息安装的,但我现在从 mssql_connect 得到一致的无法连接到服务器"错误.

I've had to move an app we wrote for a client to a new server and a remote connection I was initiating with PHP mssql_connect has ceased to work. I noticed that PHP wasn't compiled with mssql so I asked the server admin to install it. I can verify that it's now installed via PHP info but I now get a consistent "Unable to connect to server" error from mssql_connect.

这是我正在运行的非常简单的 PHP 脚本:

Here's the very simple PHP script I'm running:

$myServer = "myserver.com:5000";
$myUser = "myusername";
$myPass = "mypassword";

$dbhandle = mssql_connect($myServer, $myUser, $myPass)
or die("Couldn't connect to SQL Server on $myServer. Error: " . mssql_get_last_message());

我已经确认凭据仍然正确,但无论出于何种原因,似乎 mssql_connect 都没有做它的事情.我想知道管理员在安装扩展程序和 FreeTDS 后是否忘记了某些事情.任何指针都非常感谢!:)

I've confirmed that the credentials are still correct but for whatever reason it seems that mssql_connect just isn't doing it's thing. I'm wondering if there's something that the admin has forgotton to do having installed the extension and FreeTDS. Any pointers greatly appreciated! :)

问题解决了!!!

毕竟它是/usr/local/freetds/etc/freetds.conf 中指定的 FreeTDS 协议版本号,第 13 行必须取消注释.就是这样!:)

After all that it turned out to be the FreeTDS protocol version number as specified in /usr/local/freetds/etc/freetds.conf, line number 13 had to be uncommented. That was it! :)

推荐答案

毕竟它是/usr/local/freetds/etc/freetds.conf 中指定的 FreeTDS 协议版本号,第 13 行有取消评论.就是这样!:)

After all that it turned out to be the FreeTDS protocol version number as specified in /usr/local/freetds/etc/freetds.conf, line number 13 had to be uncommented. That was it! :)

这篇关于为什么我的服务器不能使用 PHP mssql_connect 连接到远程 MSSQL 服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆