Hi Mauro, 
your suggestion can solve this problem, adding these lines to export 
variable into /etc/initd/apache2  works fine but  I would not  change the 
original script  because when a new apache2 rpm will be installed,  it has 
to be manually managed. It is very strange that there is not a way to set 
export of these variable for example in a config.  I tried to include a 
local config file but  the   "export" command  is not accepted (apache2 
config error..) so I used SetEnv  (apache accept it)  but the variable is 
not exported. 
 
Below a list of some records APACHE_   found in /etc/* 
 
/etc/sysconfig/apache2:APACHE_CONF_INCLUDE_FILES="/etc/apache2/httpd.conf.oci8"
/etc/sysconfig/apache2:APACHE_CONF_INCLUDE_DIRS=""
/etc/sysconfig/apache2:APACHE_MODULES="actions alias auth_basic authn_file 
authz_host authz_groupfile authz_default authz_user authn_dbm autoindex 
cgi dir env expires include log_config mime negotiation setenvif ssl 
suexec userdir php5"
/etc/sysconfig/apache2:APACHE_SERVER_FLAGS=""
/etc/sysconfig/apache2:APACHE_HTTPD_CONF=""

and...here is the contents of included file:

zlinux01:~ # cat /etc/apache2/httpd.conf.oci8
SetEnv LD_LIBRARY_PATH /opt/oracle/instantclient_10_2
SetEnv TNS_ADMIN /opt/oracle/network/admin
SetEnv ORACLE_HOME /opt/oracle/instantclient_10_2

But   php  application doesn't  receive the $TNS_ADMIN.

I just add the "export TNS..."   in /etc/sysconfig/apache2  (using  vim) 
thet restarting apache2 all  works fine and variable is exported...
But there is a little problem:  next  if  use "yast sysconfig  => Network 
=> WWW => apache2" , I change something and then  "Finish",   the YAST 
rebuild  /etc/sysconfig/apache2  and  "export TNS..."  record are 
removed.. :-(


Thanks.

Cordiali saluti  / Best regards
 
        Marco Bosisio

Linux on 390 Port <[email protected]> wrote on 20/04/2012 14.37.39:

> From: Mauro Souza <[email protected]>
> To: [email protected]
> Date: 20/04/2012 14.41
> Subject: Re: apache2 how to set envirenment vars for oracle client
> Sent by: Linux on 390 Port <[email protected]>
> 
> Marco,
> 
> If you don't mind changing your apache2 init script, you can just add 
those
> lines to it:
> 
> APACHE_ENVVARS=$APACHE_CONFDIR/envvars
> source $APACHE_ENVVARS
> 
> I would put those lines just bellow the line defining APACHE_CONFDIR
> 
> Then put your variables on $APACHE_CONFDIR/envvars:
> 
> export LD_LIBRARY_PATH=/opt/oracle/instantclient_10_2:$LD_LIBRARY_PATH
> export TNS_ADMIN=/opt/oracle/network/admin
> export ORACLE_HOME=/opt/oracle/instantclient_10_2
> 
> 
> I changed your LD_LIBRARY_PATH to add your Oracle path to it, keeping 
the
> current LD_LIBRARY_PATH at the end.
> 
> I hope it helps!
> 
> Mauro
> http://mauro.limeiratem.com - registered Linux User: 294521
> Scripture is both history, and a love letter from God.
> 
> 
> Em 20 de abril de 2012 09:18, Marco Bosisio 
> <[email protected]>escreveu:
> 
> > Hi Mauro,
> >  the level is apache2-2.2.3-16.44.1 SLES10 SP4 : I searched for
> > APACHE_ENVVARS but I didn't find it.
> >
> > So I tried a similar solution working on  /usr/sbin/envvars-std  (that 
was
> > delivered with package).
> >
> > linux: # cat /usr/sbin/envvars-std
> > .....
> > # envvars-std - default environment variables for apachectl
> > #
> > # This file is generated from envvars-std.in
> > #
> > LD_LIBRARY_PATH="/usr/lib64:$LD_LIBRARY_PATH"
> > LD_LIBRARY_PATH="/usr/lib64${LD_LIBRARY_PATH+:$LD_LIBRARY_PATH}"
> > export LD_LIBRARY_PATH
> > #
> >
> > Here I added on bottom my local setting (see my first note) and 
restarted
> > (without success) apache2 : TNS_ADMIN=  was not exported.
> >
> >
> >
> >
> > > Mauro wrote
> > >I looked on my local apache2 init script and saw those lines:
> >
> > >if [ -z "$APACHE_ENVVARS" ] ; then
> >        APACHE_ENVVARS=$APACHE_CONFDIR/envvars
> >
> > >So I went to /etc/apache2 (my local Apache conf dir) and there's a
> > envvars
> > >there. So you can edit that file and put all the vars inside it.
> >
> > >Mauro
> > >http://mauro.limeiratem.com - registered Linux User: 294521
> > >Scripture is both history, and a love letter from God.
> >
> >
> > >Em 17 de abril de 2012 12:19, Marco Bosisio
> > <[email protected]>escreveu:
> >
> >
> > > Hi,
> > >  I 'm facing this problem with apache2 running on SUSE10 SP4 zLinux.
> > >
> > > Every time I restart apache2, using the "service apache2 restart"
> > command,
> > > the following variables
> > > are not set:
> > >
> > > LD_LIBRARY_PATH=/opt/oracle/instantclient_10_2
> > > TNS_ADMIN=/opt/oracle/network/admin
> > > ORACLE_HOME=/opt/oracle/instantclient_10_2
> > >
> > > It seems that  "service" (used in IPL phase too)  clears environment
> > > before start any process.
> > >
> > > Nevertheless if I restart apache2 through "/etc/init.d/apache2" the
> > > mentioned variable are properly set and everything works fine. This
> > > because I've set them in /etc/profile.local so the "root" env is 
used.
> > >
> > > Any clue or hints about the configuration file and/or instruction to 
use
> > > (export ? SetEnv ? PassEnv ?)
> > > in order to have the variables properly set at every Apache2 reboot
> > > through "service" command ?
> > > I wouldn't modify the  "/etc/init.d/apache2"  default start script 
by
> > > inserting required vars into it,  but if possible by configuring
> > something
> > > in a "*.local"  file  or in some other file untouched when apache2 
pkg
> > > will be updated.
> > >
> > > Thanks in advance..
> > >
> > >        Marco Bosisio
> > >
> > >
> > > IBM Italia S.p.A.
> > > Sede Legale: Circonvallazione Idroscalo - 20090 Segrate (MI)
> > > Cap. Soc. euro 347.256.998,80
> > > C. F. e Reg. Imprese MI 01442240030 - Partita IVA 10914660153
> > > Società con unico azionista
> > > Società soggetta all?attività di direzione e coordinamento di
> > > International Business Machines Corporation
> > >
> > > (Salvo che sia diversamente indicato sopra / Unless stated otherwise
> > > above)
> > >
> > > 
----------------------------------------------------------------------
> > > For LINUX-390 subscribe / signoff / archive access instructions,
> > > send email to [email protected] with the message: INFO 
LINUX-390 or
> > > visit
> > > http://www.marist.edu/htbin/wlvindex?LINUX-390
> > > 
----------------------------------------------------------------------
> > > For more information on Linux on System z, visit
> > > http://wiki.linuxvm.org/
> > >
> >
> >
> >
> > Cordiali saluti  / Best regards
> >
> >        Marco Bosisio
> >
> >
> >
> > IBM Italia S.p.A.
> > Sede Legale: Circonvallazione Idroscalo - 20090 Segrate (MI)
> > Cap. Soc. euro 347.256.998,80
> > C. F. e Reg. Imprese MI 01442240030 - Partita IVA 10914660153
> > Società con unico azionista
> > Società soggetta all?attività di direzione e coordinamento di
> > International Business Machines Corporation
> >
> > (Salvo che sia diversamente indicato sopra / Unless stated otherwise
> > above)
> >
> > ----------------------------------------------------------------------
> > For LINUX-390 subscribe / signoff / archive access instructions,
> > send email to [email protected] with the message: INFO LINUX-390 
or
> > visit
> > http://www.marist.edu/htbin/wlvindex?LINUX-390
> > ----------------------------------------------------------------------
> > For more information on Linux on System z, visit
> > http://wiki.linuxvm.org/
> >
> 
> ----------------------------------------------------------------------
> For LINUX-390 subscribe / signoff / archive access instructions,
> send email to [email protected] with the message: INFO LINUX-390 or 
visit
> http://www.marist.edu/htbin/wlvindex?LINUX-390
> ----------------------------------------------------------------------
> For more information on Linux on System z, visit
> http://wiki.linuxvm.org/
> 

IBM Italia S.p.A.
Sede Legale: Circonvallazione Idroscalo - 20090 Segrate (MI) 
Cap. Soc. euro 347.256.998,80
C. F. e Reg. Imprese MI 01442240030 - Partita IVA 10914660153
Società con unico azionista
Società soggetta all?attività di direzione e coordinamento di 
International Business Machines Corporation

(Salvo che sia diversamente indicato sopra / Unless stated otherwise 
above)

----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390
----------------------------------------------------------------------
For more information on Linux on System z, visit
http://wiki.linuxvm.org/

Reply via email to