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

From: Jochen Daum (jochen.daum_at_cans.co.nz)
Date: 11/23/03


Date: Mon, 24 Nov 2003 07:41:48 +1300

hI mIKE!

On 21 Nov 2003 11:03:49 -0800, googlemike@hotpop.com (Google Mike)
wrote:

>Jochen Daum <jochen.daum@cans.co.nz> wrote:
>>
>> What does telnet sqlserverip 1433 do?
>>
>
>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 ''
>

Now I'm impressed.

>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?

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/


Relevant Pages

  • HOWTO: FreeTDS for Newbies (almost complete)
    ... One way to do that is to install FreeTDS, recompile PHP, ... You can go to freetds.org and install the RPMs on Unix or Linux ...
    (comp.lang.php)
  • Re: php and freetds
    ... process of all my apache servers, everything turns ok, ... I just asked what his PHP question was. ... And if it is a FreeTDS problem, FreeTDS has its own mailing list where he can get much better help from the experts. ...
    (comp.lang.php)
  • Re: Any luck getting PHP/Linux to talk to MS SQL 2K?
    ... Jochen Daum wrote: ... > What does telnet sqlserverip 1433 do? ... I did a successful telnet to several of my ... I then read on the FreeTDS website how to use the command-line ...
    (comp.lang.php)
  • MS SQL Server Connections
    ... Without having to do a lot of major surgery, such as recompiling my ... PHP, I want to use either unixODBC or FreeTDS ... Well, again, it says Call to undefined function odbc_connect. ...
    (comp.lang.php)
  • Re: MS SQL Server Connections
    ... >PHP, I want to use either unixODBC or FreeTDS ... But compiling is not risky at all. ... Jochen Daum - CANS Ltd. ...
    (comp.lang.php)