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

独自空忆成欢 提交于 2019-12-08 02:20:15

问题


I have 2 servers: one is OpenSUSE, another one is SLES 11 sp2 Suse Linux Enterprise Server.

In order to have connection to MSSQL I have to install mssql.so for php.

OpenSUSE permits to install mssql from rpm. SLES - does not have mssql rpm, and this is why need to compile it.

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!

SLES: with mssql.so compiled =>

$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.x.x.x:49888

and if I edit freetds.conf

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

and change php like this:

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

=> successfully connected to MSSQL!

So my question is how can I have MSSQL connection on SLES (with mssql.so compiled) using this

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

and not using freetds.conf ?


回答1:


Edit freetds.conf (uncomment and change version):

from

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

to

[global]
        # TDS protocol version
    tds version = 7.0

and restart Apache.



来源:https://stackoverflow.com/questions/13180746/mssql-connect-unable-to-connect-to-server-without-freetds-conf

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!