Apache Group and User names

Mike Bird mgb-ubuntu at yosemite.net
Fri Jan 27 17:07:29 UTC 2006


On Fri, 2006-01-27 at 08:23, Wade Smart wrote:
> Im doing a tutorial on writing and reading files created through php
> and im having a bit of a problem. I understand that that file needs to
> already be created so you can set permissions on it but, my book says
> that php has no user or group that it belongs to and so you set the
> file owner and group it belongs to, to apache. I do not see that in
> the lists. Do I have to add this? Surely not. Apache is running fine
> at the moment so it must be under something not instantly
> recognizable. 

PHP is the name of an interpreted programming language and also
the name of the interpreter for that programming language.  An
interpreter is a program.  When the program is executed in a
process it uses the user and group of that process - typically
but not always the user and group of the user which started the
process from the shell or a menu or batch command etc.

When running PHP scripts from Apache2 via CGI or mod_perl the
scripts will execute in a process started by Apache2 and which
has Apache2's user and group.

In Breezy, unless someone changes the default config, the user
and group under which Apache2 runs are defined in
/etc/apache2/apache2.conf .

In Breezy, unless someone changes the default config, Apache2
runs as user www-data and group www-data .

Hoary was the same and Dapper will probably be the same.  Some
people use Apache (i.e. Apache 1.3) instead of Apache2.  I don't
recall for certain whether Apache (1.3) used www-data.www-data .

"ls -l ..." and "ls -gl ..." will show you the ownership of files
created by your PHP scripts.

"ps ax -o euser,egroup,comm" will show you the user and group
of executing processes including Apache2.  (Does anyone know
a shorthand equivalent to "ps uax" to see groups?)

--Mike Bird





More information about the ubuntu-users mailing list