Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 309151 - www-servers/apache-2.2.14-r1 doesn't get environment variables
Summary: www-servers/apache-2.2.14-r1 doesn't get environment variables
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: High normal
Assignee: Apache Team - Bugzilla Reports
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-03-12 16:24 UTC by Daniel
Modified: 2010-03-23 21:06 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel 2010-03-12 16:24:36 UTC
Apache 2.2.14-r1 doen't get environment variables for CGI scripts. 
KEEPENV into /etc/conf.d/apache2 doen't work.


Reproducible: Always
Comment 1 Doktor Notor 2010-03-12 16:40:32 UTC
Please read this document: http://httpd.apache.org/docs/2.2/env.html and explain better what "doesn't get environment variables" mean and how's it a bug.
Comment 2 Sok Ann Yap 2010-03-22 07:14:28 UTC
I believe this is the same issue as bug 46925 and bug 92891. Bugs were opened and closed, init script went through dozens of revisions, and we still don't have a way to set environment variable without modifying /etc/init.d/apache2.
Comment 3 Doktor Notor 2010-03-22 07:27:36 UTC
For starters you didn't include emerge --info. And on another note, it's a baselayout/openrc *feature* to filter environment variables. 

/etc/rc.conf
<snip>
# By default we filter the environment for our running scripts. To allow other
# variables through, add them here. Use a * to allow all variables through.
#rc_env_allow="VAR1 VAR2"
</snip>

If you want env variables passed to Apache, you need to define them in /etc/conf.d/apache2 (or, in general, in configuration file for the particular service used by the initscript) or use the above setting yourself.

So, once again - please, describe your issue *in detail*, and provide required information, such as steps to reproduce and emerge --info.
Comment 4 Daniel 2010-03-22 16:42:29 UTC
# emerge --info apache2

Portage 2.2_rc63 (default/linux/amd64/10.0, gcc-4.3.4, glibc-2.10.1-r1, 2.6.31-gentoo-r6 x86_64)
=================================================================
                        System Settings
=================================================================
System uname: Linux-2.6.31-gentoo-r6-x86_64-Intel-R-_Xeon-R-_CPU_W3505_@_2.53GHz-with-gentoo-1.12.13
Timestamp of tree: Tue, 02 Mar 2010 02:45:01 +0000
app-shells/bash:     4.0_p35
dev-java/java-config: 2.1.10
dev-lang/python:     2.6.4
dev-python/pycrypto: 2.1.0_beta1
dev-util/cmake:      2.6.4-r3
sys-apps/baselayout: 1.12.13
sys-apps/sandbox:    2.2
sys-devel/autoconf:  2.13, 2.63-r1
sys-devel/automake:  1.8.5-r3, 1.9.6-r2, 1.10.2
sys-devel/binutils:  2.18-r3
sys-devel/gcc:       4.3.4
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.6b
virtual/os-headers:  2.6.30-r1
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA @EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -march=nocona -pipe -fomit-frame-pointer"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/4.3/env /usr/kde/4.3/share/config /usr/kde/4.3/shutdown /usr/share/X11/xkb /usr/share/config"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/eselect/postgresql /etc/fonts/fonts.conf /etc/gconf /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-O2 -march=nocona -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FEATURES="assume-digests distlocks fixpackages maketest news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unmerge-logs unmerge-orphans userfetch"
GENTOO_MIRRORS="ftp://mirrors.localhost.net.ar/pub/mirrors/gentoo http://gentoo.localhost.net.ar/ http://www.las.ic.unicamp.br/pub/gentoo/ http://gentoo.c3sl.ufpr.br/ ftp://ftp.las.ic.unicamp.br/pub/gentoo/ ftp://gentoo.c3sl.ufpr.br/gentoo/ ftp://distro.ibiblio.org/pub/linux/distributions/gentoo/ http://mirror.usu.edu/mirrors/gentoo/ "
LDFLAGS="-Wl,-O1"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage/layman/perl-experimental /usr/local/portage/layman/roslin /usr/local/portage/layman/sunrise"
SYNC="rsync://rsync.samerica.gentoo.org/gentoo-portage"
USE="X acl alsa amd64 apache2 berkdb bzip2 cairo cdr cli cracklib crypt cups cxx dbus dri dvd env exif extensions extras fastcgi fortran fts3 gdbm gif gpm iconv ipv6 jbig jpeg kde kdeprefix ldap mmx mng modules msn mudflap multilib mysql ncurses nls nptl nptlonly nsplugin nvidia opengl openmp pam pcre perl png pppd python qt qt3support qt4 readline reflection semantic-desktop session spl sql sqlite sse sse2 ssl svg sysfs tcpd tiff unicode webkit xorg xulrunner zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" ELIBC="glibc" INPUT_DEVICES="evdev keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="nvidia"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LANG, LC_ALL, LINGUAS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 5 Daniel 2010-03-22 16:59:30 UTC
   I'm trying to use in my CGI scripts some environment variables (e.g. $PERL5LIB or $R_HOME), which are already been set in /etc/profile.

   The perl script (below) is quite simple:
--- 
#!/usr/bin/perl

print "LD_LIBRARY_PATH: $ENV{'LD_LIBRARY_PATH'}\n";
print "PATH: $ENV{'PATH'}\n";
print "R_HOME: $ENV{'R_HOME'}\n";
--- 

   The only variable that i see is the PATH.
---
LD_LIBRARY_PATH:
PATH: /bin:/sbin:/usr/bin:/usr/sbin:/usr/local/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin:/usr/x86_64-pc-linux-gnu/gcc-bin/4.3.4:/usr/kde/4.3/sbin:/usr/kde/4.3/bin:/usr/lib64/subversion/bin:/opt/vmware/server/bin:/opt/vmware/vix/bin
R_HOME: 
---

   My rc.conf (/etc/rc.conf) doesn't have the option rc_env_allow, but even so i set this option, restart the server, and nothing happen. 

Observation: I put the PassEnv directives into the httpd.conf, but only the SetEnv works for me.
Comment 6 Doktor Notor 2010-03-22 17:29:02 UTC
(In reply to comment #5)
>    I'm trying to use in my CGI scripts some environment variables (e.g.
> $PERL5LIB or $R_HOME), which are already been set in /etc/profile.

Well, then see above... it simply won't work like that and never did, because it's not supposed to in the first place. See the baselayout documentation. The examples I've shown are for baselayout-2/openrc. 
Comment 7 Doktor Notor 2010-03-22 18:17:23 UTC
Should be /etc/conf.d/env_whitelist for the legacy baselayout-1, so stick your stuff there.