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("192.168.50.102", "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:
- Does the SQL Server in question support remote connections?
- Do you have the port configured properly - example of defining the port mssql_connect('192.0.0.0:3456','USERNAME','PASSWORD'); for linux, use '192.0.0.0,3456' for windows
- You may want to read up on mssql_min_severity as it looks like the levels should be 0-4 not 1000... same for mssql_min_message_severity (different levels though)
Okay, that is my start at guessing what may be the problem
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 mssql.so file in order to place in my php.ini.
Now where on earth did you find that gem?
:D, Ah, I missed that 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
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: https://es.oteric.info/articles/how-to-set-up-freetds-for-connecting-to-mssql-through-php-using-an-odbc-dsn-on-ubuntu-10041
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.
This topic is now closed. New replies are no longer allowed.