[freetds] Connecting MSSQL Server from Red Hat linux + PHP

Tim Uckun tim at diligence.com
Mon Jun 30 19:14:16 EDT 2003

At 06:28 PM 6/30/2003 -0400, you wrote:
>This is regarding connection MSSQL SERVER database from windows 2000 
>server which is there in a different domain from my web which is running 
>on PHP4.1+APACHE_1.3.27+MYSQL+RED HAT Linux.
>This is the first time i 've come across this situation. I just got the 
>information from the PHP documentation about using freeTDS for this purpose.

There seems to be a lot of confusion on this so I'll do my best to try and 
summarize the situation.

My situation is a bit different then yours because I am using freebsd but 
the process should be similar.

First you need to build/install freetds with the right parameters. This 
means experimenting with database versions to get the right fit for your 
sql server version. For me the standard ports make install works just fine.

Then you build php. I use the --with-sybase-ct=/path/to/freetds

This seems to work best for me. Whether you use sybase, sybase-ct or mssql 
you will get all the sybase* and mssql* functions. They are in fact aliases 
to each other in unix.

>For this freeTDS installation i was going thru the freeTSD documentation 
>and from some user contribution details in the php site. Some mentioned 
>about configuring with sybase libraries and some said with mssql. It was 
>bit confusing me which one to use.
>Could anyone help for  install and configuring freeTDS in my linux 
>server.Once it's done how to test it whether the MSSQL server database 
>connectivity is working ok.

There is lots of help on the web on this very common setup but you will 
need to experiment and test thoroughly.  Create a table with all possible 
field types and select every combination you can think of. Select nulls 
from boolean fields, set up huge and small varchars and select them, test 
blob fields. Test, test, test and do more testing before you put it into 

Tim Uckun
US Investigations Services/Due Diligence

More information about the FreeTDS mailing list