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

freetds, php, sql-server

Solution

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.

Problem

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 ?

Original source