[freetds] Re: connecting to remote MS Sql 2k server from linux PHP

Daniel Fazekas fdsubs at axelero.hu
Thu Oct 28 19:13:33 EDT 2004


On Oct 28, 2004, at 18:31, Rick D. Conner wrote:

At first sight I guessed this would be a file access rights problem 
(the user PHP runs as doesn't have sufficient rights to read the config 
file), but I'm not that sure anymore. In fact, it's probably something 
else.
Several things look a bit weird to me.

First off, are you trying to use the php script via a web server, such 
as Apache, or is it getting run via the command-line PHP interpreter? 
It seems to be the latter. That's good, it makes it all simpler.

The weird bits:

The putenvs at the start of your script should already be too late in 
the process to set them - maybe not, since you aren't running through a 
web server -, yet the log files are obviously getting made and the 
FREETDSCONF parameter is also seen as set.

Set wrongly, I might add, as it is supposed to be a file name, not the 
name of a directory, according to the manual:
<http://www.freetds.org/userguide/envvar.htm>

Anyway, $HOME/.freetds.conf, $SYBASE/freetds.conf or {compile-time 
freetds prefix}/etc/freetds.conf would get processed automatically 
without setting any environment variables.

Further weirdness: according to the log, FreeTDS seems to find the 
myserver2k entry in /home/bwelch/.freetds.conf anyway - but it ignores 
it and doesn't seem to be looking for it, instead trying to find the 
default SYBASE entry.

Then, despite all this, at the end it tries to connect to the mssql 
default port 1433 even though the default should be sybase's port 5000 
considering it failed to get anything useful from the config files.

So I have to conclude I'm a bit confused but the FreeTDS developers 
will probably know the explanation right away. :)
In the meantime you should post the contents of all your 
FreeTDS-related configuration files.

/home/bwelch/.freetds.conf and /usr/local/freetds/etc/freetds.conf

--
fds



More information about the FreeTDS mailing list