Anyone with experience settin up FreeTDS? (cpradio?)

I know your a Microsoft guy, so I’m betting on you to come through on this one first.

I’ve compiled FreeTDS on my linux box:

./configure -enable-msdblib -prefix=/usr/local/freetds
cp include/tds.h /usr/local/freetds/include
cp src/tds/.libs/libtds.a /usr/local/freetds/lib

Successfully made a connection to my mssql server through freetds its self.

and then re-compiled php after running phpize in the mssql extension folder:

php -i | grep mssql yeilds:

 php -i | grep mssql
Configure Command =>  './configure'  '--with-mysql' '--with-pdo-mysql' '--enable-ftp' '--with-curl' '--with-libxml' '--enable-json' '--enable-soap' '--with-pear' '--with-mssql=/usr/local/freetds'
mssql.allow_persistent => On => On
mssql.batchsize => 0 => 0
mssql.charset => no value => no value
mssql.compatability_mode => Off => Off
mssql.connect_timeout => 5 => 5
mssql.datetimeconvert => On => On
mssql.max_links => Unlimited => Unlimited
mssql.max_persistent => Unlimited => Unlimited
mssql.max_procs => Unlimited => Unlimited
mssql.min_error_severity => 1000 => 1000
mssql.min_message_severity => 1000 => 1000
mssql.secure_connection => Off => Off
mssql.textlimit => Server default => Server default
mssql.textsize => Server default => Server default
mssql.timeout => 60 => 60

and threw together a quick connection test:

$db = mssql_connect("", "sa", "pass")
  or die("Couldn't connect to SQL Server. Error: " . mssql_get_last_message());

No cigar. Ideas?

EDIT: Oh, its just a generic could not connect message. Seems as if the driver loaded.

Okay, first thing to check:

  1. Does the SQL Server in question support remote connections?
  2. Do you have the port configured properly - example of defining the port mssql_connect(‘’,‘USERNAME’,‘PASSWORD’); for linux, use ‘,3456’ for windows
  3. You may want to read up on [fphp]mssql_min_severity[/fphp] as it looks like the levels should be 0-4 not 1000… same for [fphp]mssql_min_message_severity[/fphp] (different levels though)

Okay, that is my start at guessing what may be the problem :slight_smile:

Yes, it supports remote connections, I tested it using freetds from the command line.
I originally had min_severity set to the default but bumped it up after some googling.
The port is set to the default mssql port, but still doesn’t work after defining it.

I would like to note though, that I do not have a file in order to place in my php.ini.

Okay, I haven’t had direct experience with FreeTDS, but every search result I find says to associate it to with-sybase not with-mssql

Although, it does look like some do use mssql

Got it:


Now where on earth did you find that gem? in the comments. Whew.

:D, Ah, I missed that :slight_smile: I searched a few of the comments, must not have gone far enough

Ya, once I saw that the freetds.log file was getting activity from my connection attempt, and I had already made a connection from CLI, I new the problem was some sort of setting that was being passed from PHP, so when I stumbled upon that, new it was gold before it was ran :smiley:

Ahhh… mssql doesnt support fetch_row like mysql does? I’m hitting my memory limit while trying to loop through my large result set.

Do you have an exact error message? Hard to tell if it is freetds or php from your question.

Might want to read this:
Search for out-of-memory errors

It is PHP’s memory limit that is being reached, meaning it’s storing the entire result rather than fetching one row at a time.

Maybe try [fphp]mssql_data_seek[/fphp] or [fphp]mssql_result[/fphp]?