Any luck getting PHP/Linux to talk to MS SQL 2K?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Google Mike

    #1

    Any luck getting PHP/Linux to talk to MS SQL 2K?

    Anyone having any luck to get PHP on Linux to talk to MS SQL Server
    2000 via FreeTDS? Where do I begin?

    I'm a Linux newbie and a PHP newbie, but I'd say I'm beyond the idiot
    stage. I mean, I've written an entire PHP/MySQL app now, figured out
    how to configure a dual-head monitor system on Linux by editing the
    XFree86.config file, and I've been on Linux for a year. I have RH9 and
    PHP 4.2.2, although I recently up2date'd, so I probably have something
    later, but have no way to easily find this out.

    I noticed that FreeTDS is installed on my system, as is unixODBC,
    although I don't know how to use them.

    BTW, we also run MS SQL 6.5 and 7, not just 2K. Do I need to be aware
    of anything special with those versions?
  • Jochen Daum

    #2
    Re: Any luck getting PHP/Linux to talk to MS SQL 2K?

    Hi Google Mike!

    On 20 Nov 2003 13:52:47 -0800, googlemike@hotp op.com (Google Mike)
    wrote:
    [color=blue]
    >Anyone having any luck to get PHP on Linux to talk to MS SQL Server
    >2000 via FreeTDS? Where do I begin?
    >[/color]

    [color=blue]
    >I'm a Linux newbie and a PHP newbie, but I'd say I'm beyond the idiot
    >stage. I mean, I've written an entire PHP/MySQL app now, figured out
    >how to configure a dual-head monitor system on Linux by editing the
    >XFree86.conf ig file, and I've been on Linux for a year. I have RH9 and
    >PHP 4.2.2, although I recently up2date'd, so I probably have something
    >later, but have no way to easily find this out.
    >
    >I noticed that FreeTDS is installed on my system, as is unixODBC,
    >although I don't know how to use them.
    >
    >BTW, we also run MS SQL 6.5 and 7, not just 2K. Do I need to be aware
    >of anything special with those versions?[/color]

    As far as I remember there is nothing special to get connected. Have
    you checked you local firewall etc.

    What does telnet sqlserverip 1433 do?

    HTH, Jochen

    --
    Jochen Daum - CANS Ltd.
    PHP DB Edit Toolkit -- PHP scripts for building
    database editing interfaces.
    http://sourceforge.net/projects/phpdbedittk/

    Comment

    • Google Mike

      #3
      Re: Any luck getting PHP/Linux to talk to MS SQL 2K?

      Jochen Daum <jochen.daum@ca ns.co.nz> wrote:[color=blue]
      >
      > What does telnet sqlserverip 1433 do?
      >[/color]

      Jochen,

      Hey. Thanks for your help. I did a successful telnet to several of my
      NT 4 and W2K SQL Servers in my office running 6.5, 7, and 2K. For
      everyone besides you and me who doesn't know this, that gets me on
      port 1433, but since I don't speak the TDS language with my fingers,
      it won't work, of course. It does, however, show me that my firewall
      configuration is set just right on my network to enable access.

      I found some FreeTDS RPMS on freetds.org and installed these
      successfully.

      So, I then read on the FreeTDS website how to use the command-line
      command that comes with FreeTDS called tsql.

      Man, that tsql command was a godsend. I immediately typed:

      tsql -S ip.ip.ip.ip -H windows01 -p 1433 -U sa -P ''

      You replace ip.ip.ip.ip with the IP address of the remote system. You
      replace windows01 with the server name. If you have no password, you
      do -P ''. Otherwise, you do -P <password>.

      This got me on and I see:

      1>

      Press enter and I see 2>, and so on. Aha. I've seen an interface like
      this before! I then typed:

      use pubs
      go
      select * from authors
      go
      quit

      Wow. I was able to see authors on all the 6.5, 7, and 2K servers I
      have here, regardless of whether or not it was NT 4 or W2K.

      Now I need to connect PHP 4.2.2 (the PHP that ships with RH9) to
      FreeTDS by recompiling with the option --with-mssql=/usr/lib because
      /usr/lib is where FreeTDS was installed (if I have that right).

      Anyone know how to recompile PHP 4.2.2 with this option? My attempts
      to download 4.2.2 and recompile have been met with trouble -- it won't
      generate a make file for me. I thought this is because I have
      downloaded php-4.2.2 rather than php-devel-4.2.2. Is that correct?

      Comment

      • Jochen Daum

        #4
        Re: Any luck getting PHP/Linux to talk to MS SQL 2K?

        hI mIKE!

        On 21 Nov 2003 11:03:49 -0800, googlemike@hotp op.com (Google Mike)
        wrote:
        [color=blue]
        >Jochen Daum <jochen.daum@ca ns.co.nz> wrote:[color=green]
        >>
        >> What does telnet sqlserverip 1433 do?
        >>[/color]
        >
        >Jochen,
        >
        >Hey. Thanks for your help. I did a successful telnet to several of my
        >NT 4 and W2K SQL Servers in my office running 6.5, 7, and 2K. For
        >everyone besides you and me who doesn't know this, that gets me on
        >port 1433, but since I don't speak the TDS language with my fingers,
        >it won't work, of course. It does, however, show me that my firewall
        >configuratio n is set just right on my network to enable access.
        >
        >I found some FreeTDS RPMS on freetds.org and installed these
        >successfully .
        >
        >So, I then read on the FreeTDS website how to use the command-line
        >command that comes with FreeTDS called tsql.
        >
        >Man, that tsql command was a godsend. I immediately typed:
        >
        >tsql -S ip.ip.ip.ip -H windows01 -p 1433 -U sa -P ''
        >[/color]

        Now I'm impressed.
        [color=blue]
        >You replace ip.ip.ip.ip with the IP address of the remote system. You
        >replace windows01 with the server name. If you have no password, you
        >do -P ''. Otherwise, you do -P <password>.
        >
        >This got me on and I see:
        >
        >1>
        >
        >Press enter and I see 2>, and so on. Aha. I've seen an interface like
        >this before! I then typed:
        >
        >use pubs
        >go
        >select * from authors
        >go
        >quit
        >
        >Wow. I was able to see authors on all the 6.5, 7, and 2K servers I
        >have here, regardless of whether or not it was NT 4 or W2K.
        >
        >Now I need to connect PHP 4.2.2 (the PHP that ships with RH9) to
        >FreeTDS by recompiling with the option --with-mssql=/usr/lib because
        >/usr/lib is where FreeTDS was installed (if I have that right).
        >
        >Anyone know how to recompile PHP 4.2.2 with this option? My attempts
        >to download 4.2.2 and recompile have been met with trouble -- it won't
        >generate a make file for me. I thought this is because I have
        >downloaded php-4.2.2 rather than php-devel-4.2.2. Is that correct?[/color]

        Hmm. You need some PHP source (4.3.4 or so) and FreeTDS-dev and
        whatever-dev you compile as well. Quite often the versions didn't
        quite match, especially on debian, so I often also compile the other
        packages from source (like FreeTDS, curl etc.)

        Its then pretty straightforward . You might have to read some README's,
        because some stuff needs environment variables set.

        HTH, Jochen


        --
        Jochen Daum - CANS Ltd.
        PHP DB Edit Toolkit -- PHP scripts for building
        database editing interfaces.
        http://sourceforge.net/projects/phpdbedittk/

        Comment

        Working...