Skip to Content.
Sympa Menu

freetds - Re: Install freetds on a RaQ4 to work with MS SQL and PHP

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Casey Allen Shobe <cshobe AT secureworks.net>
  • To: "Del" <sherman AT ccso.org>
  • Cc: "TDS Development Group" <freetds AT franklin.oit.unc.edu>
  • Subject: Re: Install freetds on a RaQ4 to work with MS SQL and PHP
  • Date: Tue, 30 Apr 2002 18:54:19 -0400


On Tuesday 30 April 2002 16:08, Del wrote:
> I would like to make calls to an mssql server using php, I have tried to
> get freetds set up but I dont seem to be having much success, the
> instructions that are on the freetds site don't quite match how the RaQ4
> (linux) is set up, plus I'm also stuck on how to re-compile php to work
> with freetds. Can anyone help?

It's not too difficult - we use some RAQ3 servers here, though a very
customized linux configuration.

I have a custom build of Apache, FreeTDS, and PHP with --enable-sybase-ct on a
RAQ3, which performs reliably.

Unfortunately, rebuilding PHP is the most difficult, as you have to manually
edit the configure script to work with FreeTDS as opposed to the Sybase
library which it emulates/replaces.

It took me quite some time to get going, but now that I've done it it's pretty
straightforward. Below follows instructions:

Remove PHP in whatever form it currently exists on the box.

Install FreeTDS. Here's how I did it:
freetds-0.53 installed with the following options on Sat Jan 26 20:49:12 EST
2002
./configure --prefix=/usr --sysconfdir=/etc --with-tdsver=4.2
--with-unixodbc=/usr &&
make &&
make install

Install PHP. Here's how I did it:
php-4.1.2 installed with the following options on Thu Apr 25 02:29:14 EDT 2002
<Search for and delete -lcs, -lcomn, -lsybtcl out of configure script. Run
the following as root>
./configure --prefix=/usr --sysconfdir=/etc --without-mysql
--with-apxs=`which apxs` --enable-memory-limit --with-zlib --with-bz2
--with-config-file-path=/etc --with-sybase-ct=/usr --enable-bcmath &&
make &&
make install

Configure /etc/freetds.conf. Here's how I did it:
[global]
tds version = 4.2
initial block size = 512
swap broken dates = no
swap broken money = no
try server login = yes
try domain login = no
nt domain = SECUREWORKS
cross domain login = yes
dump file = /tmp/freetds.log
debug level = 10
[192.168.24.6]
host = 192.168.24.6
port = 1433
tds version = 7.0
try domain logins = no
try server logins = yes

Restart the webserver. apachectl restart.

Write a nice PHP script like the following:
<?php
$conn = sybase_connect ('192.168.0.1', 'username', 'password')
or die('<br><font size="+2"><b>Unable to connect to Database!!</b></font>');
sybase_select_db ('Your Database Name', $conn);
$row_data = sybase_query ('select something from somewhere where
something="blah"', $conn);
echo (sybase_result ($row_data, 0, 0));
?>

Hope this helps,

--
Casey Allen Shobe / Network Security Analyst & PHP Developer
SecureWorks, Inc. / 404.327.6339 x169 / Fax: 404.728.0144
cshobe AT secureworks.net / http://www.secureworks.net
Content is my own and does not necessarily represent my company.




Archive powered by MHonArc 2.6.24.

Top of Page