SitePoint Sponsor

User Tag List

Results 1 to 14 of 14
  1. #1
    Always A Novice bronze trophy
    K. Wolfe's Avatar
    Join Date
    Nov 2003
    Location
    Columbus, OH
    Posts
    2,182
    Mentioned
    67 Post(s)
    Tagged
    2 Thread(s)

    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:

    Code:
    ./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:

    Code:
     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:

    Code PHP:
    <?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.

  2. #2
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,235
    Mentioned
    154 Post(s)
    Tagged
    0 Thread(s)
    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('192.0.0.0:3456','USERNAME','PASSWORD'); for linux, use '192.0.0.0,3456' for windows
    3. 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

  3. #3
    Always A Novice bronze trophy
    K. Wolfe's Avatar
    Join Date
    Nov 2003
    Location
    Columbus, OH
    Posts
    2,182
    Mentioned
    67 Post(s)
    Tagged
    2 Thread(s)
    Quote Originally Posted by cpradio View Post
    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('192.0.0.0:3456','USERNAME','PASSWORD'); for linux, use '192.0.0.0,3456' for windows
    3. 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.

  4. #4
    Always A Novice bronze trophy
    K. Wolfe's Avatar
    Join Date
    Nov 2003
    Location
    Columbus, OH
    Posts
    2,182
    Mentioned
    67 Post(s)
    Tagged
    2 Thread(s)
    I would like to note though, that I do not have a mssql.so file in order to place in my php.ini.

  5. #5
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,235
    Mentioned
    154 Post(s)
    Tagged
    0 Thread(s)
    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
    http://www.peceny.de/misc/freetds.html

    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/...on-ubuntu-810/

  6. #6
    Always A Novice bronze trophy
    K. Wolfe's Avatar
    Join Date
    Nov 2003
    Location
    Columbus, OH
    Posts
    2,182
    Mentioned
    67 Post(s)
    Tagged
    2 Thread(s)
    Got it:

    putenv('TDSVER=70');

  7. #7
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,235
    Mentioned
    154 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by K. Wolfe View Post
    Got it:

    putenv('TDSVER=70');
    Now where on earth did you find that gem?

  8. #8
    Always A Novice bronze trophy
    K. Wolfe's Avatar
    Join Date
    Nov 2003
    Location
    Columbus, OH
    Posts
    2,182
    Mentioned
    67 Post(s)
    Tagged
    2 Thread(s)

  9. #9
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,235
    Mentioned
    154 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by K. Wolfe View Post
    , Ah, I missed that I searched a few of the comments, must not have gone far enough

  10. #10
    Always A Novice bronze trophy
    K. Wolfe's Avatar
    Join Date
    Nov 2003
    Location
    Columbus, OH
    Posts
    2,182
    Mentioned
    67 Post(s)
    Tagged
    2 Thread(s)
    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

  11. #11
    Always A Novice bronze trophy
    K. Wolfe's Avatar
    Join Date
    Nov 2003
    Location
    Columbus, OH
    Posts
    2,182
    Mentioned
    67 Post(s)
    Tagged
    2 Thread(s)
    Ahhh... mssql doesnt support fetch_row like mysql does? I'm hitting my memory limit while trying to loop through my large result set.

  12. #12
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,235
    Mentioned
    154 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by K. Wolfe View Post
    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-...n-ubuntu-10041
    Search for out-of-memory errors

  13. #13
    Always A Novice bronze trophy
    K. Wolfe's Avatar
    Join Date
    Nov 2003
    Location
    Columbus, OH
    Posts
    2,182
    Mentioned
    67 Post(s)
    Tagged
    2 Thread(s)
    Quote Originally Posted by cpradio View Post
    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-...n-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.

  14. #14


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •