Skip to Content.
Sympa Menu

freetds - Re: [freetds] mssql_connect fails with PHP 4.3.4 on RH Linux 9

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Daniel Fazekas <fdsubs AT axelero.hu>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] mssql_connect fails with PHP 4.3.4 on RH Linux 9
  • Date: Fri, 5 Dec 2003 00:36:59 +0100


On Dec 4, 2003, at 23:51, James McGowan wrote:

OK, I created a simple PHP script with a simple SQL query. When run as root, the log file fills with fascinating info and the correct result is returned. However, when run from the nobody account (or from my own login), the log contains only these lines:

So the one thing we now know for certain is that it has something to do with access rights.

Actually, this could be as simple as the non-root accounts having no read access to your freetds.conf file.

Try viewing them with their credentials, and I'm sure you'll get something like this:

[fds@]$ cat /usr/local/etc/freetds.conf
cat: /usr/local/etc/freetds.conf: Permission denied

(You have freetds installed in /usr/local/freetds/etc instead, as far as I remember.)

To test it, I chmod'ded my freetds.conf to make sure only root can read it, and sure enough, I got the same errror message from PHP as you did, and I also got the same error message in the log.. Which is generated in login.c's tds_login().


Chances are, all you have to do is

chmod 644 /usr/local/freetds/etc/freetds.conf

and that's it for this lengthy problem. :)

This sounds a bit too simple to believe so there might be a bit more to it, such as not having "execute" rights for all the parent folders, namely, /usr, /usr/local, /usr/local/freetds and /usr/local/freetds/etc... Make sure other has at least execute to all of them.

chmod 755 /usr /usr/local /usr/local/freetds /usr/local/freetds/etc


Now there are still many imaginative ways in which you could deny access to a certain file, running a paranoid high security kernel, chroot caged accounts and the like, but it all comes down to: make sure you can read that freetds.conf file from those accounts.

--
fds





Archive powered by MHonArc 2.6.24.

Top of Page