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: "James McGowan" <jmcgowan AT luxurylink.com>
  • 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: Wed, 3 Dec 2003 17:03:35 -0800

Sorry, dude. Next time I'll follow your every word! :)

> From: Daniel Fazekas [mailto:fdsubs AT axelero.hu]
> Sent: Tuesday, December 02, 2003 1:48 PM
> To: FreeTDS Development Group
> Subject: Re: [freetds] mssql_connect fails with PHP 4.3.4 on
> RH Linux 9
>
>
> On Dec 2, 2003, at 21:11, James McGowan wrote:
>
> You ignored my best idea to try. Don't. :)
>
> >> Could you try a short test without Apache?
> >>
> >> Just create a short .php script which doesn't assume it's
> a web page,
> >> and test if from the command-line:
> >>
> >> php testscript.php
>
> This should help narrow down the problem a lot.

I've already tested this using a one-line script, calling <?phpinfo()?>. This
returns all of the PHP settings in non-html text, so the CGI mode of PHP
works, running from root or as nobody. PHP runs "inside" Apache which runs as
user nobody.

>
> >> 1. "dump file = /var/log/freetds", and
> >> 2. "/var/log/freetds" is a filename, and
> >> 3. the process has permission to write to "/var/log",
> >
> > 1. is correct
> > 2. is correct
> > 3. Apache or PHP? Apache writes its own access_log to
> > /var/log, and I have a mod_php_error log that writes there as well.
> > Neither log file reveals anything of interest.
>
> When you are running PHP from the command line, PHP has the access
> privileges of your shell. When it's run via Apache, it shares
> Apache's privileges.
>
> That other processes can write to other log files doesn't
> mean anything.
>
> Usually, /var/log is owned by root:root and only root can write there.
> To let specific non-root processes write their own log files
> there, the
> common method is to pre-create (as root) either a subdirectory or a
> file for them, then that file or subdirectory's owner is
> changed to the process' UID.
>
> Try:
> [fds@fds fds]$ ls -lad /var/log
> drwxr-xr-x 8 root root 4096 Dec 1 04:02 /var/log

Yup. Same.

> Apache, I believe, keeps it's root credentials to write the
> log files, but FreeTDS won't have that.
>
> So you can just pre-create the log file by issuing
>
> touch /var/log/freetds
>
> and then change it's owner to
>
> chown apache /var/log/freetds

Well, chown'ed to nobody, but I follow you.

> Depending on what user apache is impersonating.
> Check
> ps waux | grep httpd

Yup. Child procs owned by nobody.

> The very first word per line will be the user name. The very first
> httpd process will be running as root, and all the others as
> something else. That's the one you need.

>
> By running tsql and making it create the log file, the file probably
> already exists with root or your personal user's rights, giving
> apache-php-freetds no access to write to it.

Well, even after chown'ing the file and even making /var/log writeable by
everyone, FreeTDS won't write to it. I'm convinced it's a permissions issue.
When I do a sqsh query using a non-root account, all kinds of junk gets
dumped into the log.

> --
> Daniel

Jim




Archive powered by MHonArc 2.6.24.

Top of Page