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
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:
<?php
$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.
cpradio
February 13, 2013, 11:00am
2
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 [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
cpradio:
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 [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
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.
cpradio
February 13, 2013, 2:50pm
5
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
http://docs.moodle.org/23/en/Installing_MSSQL_for_PHP
http://www.robert-gonzalez.com/2009/02/18/building-the-php-ms-sql-server-extension-from-source-on-ubuntu-810/
cpradio
February 13, 2013, 3:09pm
7
Got it:
putenv(‘TDSVER=70’);
Now where on earth did you find that gem?
cpradio
February 13, 2013, 3:27pm
9
: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.
cpradio
February 13, 2013, 4:09pm
12
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.
cpradio
February 13, 2013, 4:21pm
14
Maybe try [fphp]mssql_data_seek[/fphp] or [fphp]mssql_result[/fphp]?