PHP using wrong port with mssql_connect

Problems with the Linux version of XAMPP, questions, comments, and anything related.

PHP using wrong port with mssql_connect

Postby jimaz » 14. April 2010 22:41

I have an application written in PHP that uses MySQL provided with XAMPP without any trouble. I now need to extend the application to also query a Microsoft SQL Server, so I tried using the "mssql_connect", et. al. routines, without success. The call to mssql_connect("servername", "uid", "passsword"); fails, apparently, it is trying to connect on port 4000 instead of port 1433 (as reported by wireshark). I know port 1433 is used by the database because other applications connect on 1433.

I did search the web and found freetds, which is installed (XAMPP 1.7.3a) and edited the freetds.conf file to enable the entries for SQL Server (Server 7.0, Server 2000, and Server 6.x), setting "host" to the correct host name and "port" was already 1433. Restarted XAMPP (via lampp restart), but 4000 continues to be used for the port.

Being relatively new to this technology, I suspect there might be a simple fix for this, I just have not been able to find it. I appreciate all help.

Posts: 2
Joined: 18. March 2010 00:13

Re: PHP using wrong port with mssql_connect

Postby PhillipS » 22. April 2010 07:27

Can you try: /opt/lampp/bin/tsql -S mssrv -U ***** -P ***** after changing the "freetds.conf" file (see mine below)

I have a similar problem except that trying to connect to MS-SQL2005Express running openSUSE 11.2
freeTDS says we need to add "instance" but getting error.
Some say 'TDS version: 5.0' is wrong - I am not sure...

# A typical Microsoft SQL Server 2000 configuration (freetds.conf)
tds version=8.0

# /opt/lampp/bin/tsql -S myserver -U ***** -P *****
locale is "en_US.UTF-8"
locale charset is "UTF-8"
FreeTDS: config.c:461: ignoring unrecognized option 'instance'
src/tds/login.c: tds_connect: Connection refused
Msg 20009, Level 9, State 0, Server OpenClient, Line 0
Server is unavailable or does not exist.
There was a problem connecting to the server

# /opt/lampp/bin/tsql -C
Compile-time settings (established with the "configure" script):
Version: freetds v0.63
MS db-lib source compatibility: no
Sybase binary compatibility: unknown
Thread safety: yes
iconv library: yes
TDS version: 5.0
iODBC: no
Posts: 1
Joined: 22. April 2010 07:07

Return to XAMPP for Linux

Who is online

Users browsing this forum: No registered users and 7 guests