简体   繁体   English

mssql_connect():无法连接到服务器(没有freetds.conf)

[英]mssql_connect(): Unable to connect to server (without freetds.conf)

I have 2 servers: one is OpenSUSE, another one is SLES 11 sp2 Suse Linux Enterprise Server. 我有2台服务器:一台是OpenSUSE,另一台是SLES 11 sp2 Suse Linux Enterprise Server。

In order to have connection to MSSQL I have to install mssql.so for php. 为了连接到MSSQL,我必须为php安装mssql.so。

OpenSUSE permits to install mssql from rpm. OpenSUSE允许从rpm安装mssql。 SLES - does not have mssql rpm, and this is why need to compile it. SLES - 没有mssql rpm,这就是为什么需要编译它。

OpenSUSE: mssql rpm installed => OpenSUSE:mssql rpm installed =>

$server="172.x.x.x:49888";
$username="username";
$password="password";
$link = mssql_connect($server, $username, $password);

here successfully connected to MSSQL! 这里成功连接到MSSQL!

SLES: with mssql.so compiled => SLES:用mssql.so编译=>

$server="172.x.x.x:49888";
$username="username";
$password="password";
$link = mssql_connect($server, $username, $password);

error: Warning: mssql_connect(): Unable to connect to server: 172.xxx:49888 错误:警告:mssql_connect():无法连接到服务器:172.xxx:49888

and if I edit freetds.conf 如果我编辑freetds.conf

#A typical Microsoft server
[Dovico]
    host = 172.x.x.x
    port = 49888
    tds version = 7.0

and change php like this: 并改变这样的PHP:

$server="Dovico";
$username="username";
$password="password";
$link = mssql_connect($server, $username, $password);

=> successfully connected to MSSQL! =>成功连接到MSSQL!

So my question is how can I have MSSQL connection on SLES (with mssql.so compiled) using this 所以我的问题是如何使用这个在SLES(使用mssql.so编译)上建立MSSQL连接

mssql_connect("172.x.x.x:49888", "username", "password");

and not using freetds.conf ? 而不是使用freetds.conf?

Edit freetds.conf (uncomment and change version): 编辑freetds.conf (取消注释并更改版本):

from

[global]
        # TDS protocol version
;   tds version = 4.2

to

[global]
        # TDS protocol version
    tds version = 7.0

and restart Apache. 并重启Apache。

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

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