By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,117 Members | 1,093 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,117 IT Pros & Developers. It's quick & easy.

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

P: n/a
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?
Jul 17 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Hi Google Mike!

On 20 Nov 2003 13:52:47 -0800, go********@hotpop.com (Google Mike)
wrote:
Anyone having any luck to get PHP on Linux to talk to MS SQL Server
2000 via FreeTDS? Where do I begin?
http://groups.google.co.nz/groups?hl...=Google+Search
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?


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/
Jul 17 '05 #2

P: n/a
Jochen Daum <jo*********@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 ''

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?
Jul 17 '05 #3

P: n/a
hI mIKE!

On 21 Nov 2003 11:03:49 -0800, go********@hotpop.com (Google Mike)
wrote:
Jochen Daum <jo*********@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/
Jul 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.