Click to See Complete Forum and Search --> : how to determine what group my webserver belongs to
chucklarge
09-16-2004, 05:47 PM
Hi,
I need to figure out what group my webserver belongs to. I am running rh fc2 and apache 2.0.50. This is a line from my php_info
User/Group apache(48)/48
So does this mean my webserver belongs to group 48? Someone told me that 'www' is a common group, is this a group that people manually create, then add httpd to it? Can i change group 48 to www then?
I am just confused by all this.
Thanks,
Chuck
stolzyboy
09-16-2004, 06:04 PM
is there any particular reason you need to change the group??
chucklarge
09-16-2004, 06:32 PM
well i don't have to change the group, i just need to figure out what group it is really.
bubblenut
09-16-2004, 07:00 PM
try
ps -Alf | grep httpd
dalecosp
10-09-2004, 12:44 PM
Originally posted by bubblenut
try
ps -Alf | grep httpd
Hmm, not sure about Linux, but "-A" is not a ps(1) option on *BSD. Little "a", perhaps?
Maybeps -ax -o rgroup -o pid -o command | grep httpd.
For the archives, the PHP way might be:<?php
$file="/tmp/foobarbaz";
$tickle=touch($file);
$group=posix_getgrgid(filegroup($file));
echo $group['name'];
?>Of course, one wonders if you couldn't just create the file and call system('ls -l"); on the directory....
Note that, with Apache as an example, many web servers use multiple processes, and what works for one process might or might not work on another. On my test box, the script above creates a file with group "wheel" ... but most of the Apache processes are actually running as group "www". Probably some Unix genius can tell us why the file seems to be created by the parent process ... if those genuii (genuises?) ever come here ;)
As for the OP, it's likely that phpinfo() is right. "apache", "www", "nobody", "httpd", and "daemon" are all pretty common usernames for Apache UID's, and many seem to use the same names for groups....
PHP Builder
Copyright WebMediaBrands Inc. All Rights Reserved.