Bug 132769 - apache startup script does not reset $HOME
Summary: apache startup script does not reset $HOME
Status: RESOLVED FIXED
Alias: None
Product: SUSE LINUX 10.0
Classification: openSUSE
Component: Network (show other bugs)
Version: Final
Hardware: Other Other
: P5 - None : Normal
Target Milestone: ---
Assignee: Peter Poeml
QA Contact: E-mail List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-11-08 18:09 UTC by Dennis Lubert
Modified: 2006-12-20 15:02 UTC (History)
0 users

See Also:
Found By: Other
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dennis Lubert 2005-11-08 18:09:01 UTC
Hi,

I was recently trying to install a web application that needs a proper $HOME variable set. Unfortunately the startup scripts leave HOME as is, thus pointing to /root which is of course not accesible by the webservers user which is running apps. As a workardound one can hardcode an export HOME= to a proper directory, but the best solution would be to get the information out of /etc/passwd and set it in  the startup scripts so apache will run with a usable HOME
Comment 1 Peter Poeml 2005-11-09 11:21:52 UTC
You should read 
http://httpd.apache.org/docs/2.0/env.html
and use SetEnv.
Comment 2 Dennis Lubert 2005-11-09 12:49:26 UTC
From the docs:

SetEnv
Sets an environment variable, which is then passed on to CGI scripts and SSI pages.

Put php is seldom run as cgi, in fact most php software does not work when run as cgi. And when a php script starts some program, these environment settings wont apply, thus using e.g. $HOME from the apache server. This happens e.g. on svn browsing software which runs svn command.

The variable with SetEnv makes it to the _SERVER array, but the program started e.g. by system() sees whats in the _ENV array.
Comment 3 Marcus Rückert 2005-11-09 13:43:34 UTC
just set the proper values in the init script. setting a proper home doesnt harm. not only for php stuff but for other cgi based stuff too.

Comment 4 Peter Poeml 2005-11-09 14:56:26 UTC
Okay, mod_php.

You can work around by setting HOME (or other environment variables) in
/etc/sysconfig/apache2.

For 10.1, we will set HOME to /var/lib/apache2. In addition, we will
clean the environment a bit (which might make overriding envvars
impossible, depending on how we do it...).
Comment 5 Peter Poeml 2005-11-18 10:47:41 UTC
downgrading severity
Comment 6 Cristian Rodríguez 2006-05-14 09:37:21 UTC
PHP doesn't set $_ENV by default. you need to configure 

variables_order = "EGPCS" to get $_ENV populated

or use apache_setenv to set it.

This is the expected behaviuor.


Comment 7 Peter Poeml 2006-12-20 15:02:54 UTC
I have set HOME in rcapache2 now, defaulting to /var/lib/apache2.
Submitted to the buildservice, will turn up in 10.3 later.