[opensuse] Apache2 and environment variables
Is there any elegant-already-thought way of setting environment variables for apache2? (that means not touching /etc/init.d/apache2), i've added oci8 support for apache2 on a server and defined variables in '/etc/profile.d' which allows me to start apache2 with oci8 support, BUT if the server is restarted apache2 starts without oci8 module and I have to restart manually. Regards, Ciro -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Ciro Iriarte wrote:
Is there any elegant-already-thought way of setting environment variables for apache2? (that means not touching /etc/init.d/apache2),
SetEnv ?
i've added oci8 support for apache2 on a server and defined variables in '/etc/profile.d' which allows me to start apache2 with oci8 support, BUT if the server is restarted apache2 starts without oci8 module and I have to restart manually.
Ah, then just add them to the command line via /etc/sysconfig/apache2 : "-Dxxxxx" /Per Jessen, Zürich -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
2008/8/11 Per Jessen
Ciro Iriarte wrote:
Is there any elegant-already-thought way of setting environment variables for apache2? (that means not touching /etc/init.d/apache2),
SetEnv ?
i've added oci8 support for apache2 on a server and defined variables in '/etc/profile.d' which allows me to start apache2 with oci8 support, BUT if the server is restarted apache2 starts without oci8 module and I have to restart manually.
Ah, then just add them to the command line via /etc/sysconfig/apache2 : "-Dxxxxx"
/Per Jessen, Zürich
Hi, tried setting them in /etc/sysconfig/apache2, but didn't work after reboot. --------- APACHE_SERVER_FLAGS="SSL ORACLE_HOME=/opt/oracle/instantclient_11_1 TNS_ADMIN=/opt/oracle/instantclient_11_1/network/admin LD_LIBRARY_PATH=/opt/oracle/instantclient_11_1" ---------- Ciro
Ciro Iriarte wrote:
Hi, tried setting them in /etc/sysconfig/apache2, but didn't work after reboot.
Show us what you did in /etc/sysconfig/apache2 - setting e.g. SSL has never caused any problems for me. /Per Jessen, Zürich -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
2008/8/12 Per Jessen
Ciro Iriarte wrote:
Hi, tried setting them in /etc/sysconfig/apache2, but didn't work after reboot.
Show us what you did in /etc/sysconfig/apache2 - setting e.g. SSL has never caused any problems for me.
/Per Jessen, Zürich
The SSL option is from an already working SSL configuration, I just added the Oracle environment variables. -----/etc/sysconfig/apache2----- APACHE_CONF_INCLUDE_FILES="" APACHE_CONF_INCLUDE_DIRS="" 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 ldap authnz_ldap rewrite oci8" APACHE_SERVER_FLAGS="SSL ORACLE_HOME=/opt/oracle/instantclient_11_1 TNS_ADMIN=/opt/oracle/instantclient_11_1/network/admin LD_LIBRARY_PATH=/opt/oracle/instantclient_11_1" APACHE_HTTPD_CONF="" APACHE_MPM="" APACHE_SERVERADMIN="" APACHE_SERVERNAME="" APACHE_START_TIMEOUT="2" APACHE_SERVERSIGNATURE="on" APACHE_LOGLEVEL="warn" APACHE_ACCESS_LOG="/var/log/apache2/access_log combined" APACHE_USE_CANONICAL_NAME="off" APACHE_SERVERTOKENS="OS" APACHE_EXTENDED_STATUS="off" APACHE_BUFFERED_LOGS="off" APACHE_TIMEOUT="300" ---------------------------------------- Ciro N�����r��y隊Z)z{.�ﮞ˛���m�)z{.��+�Z+i�b�*'jW(�f�vǦj)h���Ǿ��i�������
Ciro Iriarte wrote:
Hi, tried setting them in /etc/sysconfig/apache2, but didn't work after reboot.
Show us what you did in /etc/sysconfig/apache2 - setting e.g. SSL has never caused any problems for me.
/Per Jessen, Zürich
The SSL option is from an already working SSL configuration, I just added the Oracle environment variables.
-----/etc/sysconfig/apache2----- APACHE_CONF_INCLUDE_FILES="" APACHE_CONF_INCLUDE_DIRS="" 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 ldap authnz_ldap rewrite oci8"
APACHE_SERVER_FLAGS="SSL ORACLE_HOME=/opt/oracle/instantclient_11_1 TNS_ADMIN=/opt/oracle/instantclient_11_1/network/admin LD_LIBRARY_PATH=/opt/oracle/instantclient_11_1"
Ah, now I understand - sorry, I'm being a bit slow. I think you'll have to set those in the startup script, i.e. /etc/init.d/apache2. That way they'll be available to the oci8 module. AFAICT, the command line is only for setting binary flags. /Per Jessen, Zürich -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
2008/8/12 Per Jessen
Ciro Iriarte wrote:
Hi, tried setting them in /etc/sysconfig/apache2, but didn't work after reboot.
Show us what you did in /etc/sysconfig/apache2 - setting e.g. SSL has never caused any problems for me.
/Per Jessen, Zürich
The SSL option is from an already working SSL configuration, I just added the Oracle environment variables.
-----/etc/sysconfig/apache2----- APACHE_CONF_INCLUDE_FILES="" APACHE_CONF_INCLUDE_DIRS="" 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 ldap authnz_ldap rewrite oci8"
APACHE_SERVER_FLAGS="SSL ORACLE_HOME=/opt/oracle/instantclient_11_1 TNS_ADMIN=/opt/oracle/instantclient_11_1/network/admin LD_LIBRARY_PATH=/opt/oracle/instantclient_11_1"
Ah, now I understand - sorry, I'm being a bit slow.
I think you'll have to set those in the startup script, i.e. /etc/init.d/apache2. That way they'll be available to the oci8 module. AFAICT, the command line is only for setting binary flags.
/Per Jessen, Zürich
Ok, going the non elegant route then... :D Regards, Ciro N�����r��y隊Z)z{.�ﮞ˛���m�)z{.��+�Z+i�b�*'jW(�f�vǦj)h���Ǿ��i�������
Ciro Iriarte wrote:
Ok, going the non elegant route then... :D
Hi Ciro I've been doing some experimenting this morning, and setting environment variables in /etc/sysconfig/apache2 works just fine. I've just added your three lines to the end of /etc/sysconfig/apache2 like this: ORACLE_HOME=/opt/oracle/instantclient_11_1 TNS_ADMIN=/opt/oracle/instantclient_11_1/network/admin LD_LIBRARY_PATH=/opt/oracle/instantclient_11_1 To ascertain whether they've been properly set, I added logger -i act=$1 oracle=$ORACLE_HOME to /etc/init.d/apache2 just after . /usr/share/$pname/load_configuration export ${!APACHE_*} Check your /var/log/messages - it's working on my system. What I don't know is if those variables are also available to the oci8 module once it's loaded. /Per Jessen, Zürich -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
2008/8/13 Per Jessen
Ciro Iriarte wrote:
Ok, going the non elegant route then... :D
Hi Ciro
I've been doing some experimenting this morning, and setting environment variables in /etc/sysconfig/apache2 works just fine.
I've just added your three lines to the end of /etc/sysconfig/apache2 like this:
ORACLE_HOME=/opt/oracle/instantclient_11_1 TNS_ADMIN=/opt/oracle/instantclient_11_1/network/admin LD_LIBRARY_PATH=/opt/oracle/instantclient_11_1
To ascertain whether they've been properly set, I added
logger -i act=$1 oracle=$ORACLE_HOME
to /etc/init.d/apache2
just after
. /usr/share/$pname/load_configuration export ${!APACHE_*}
Check your /var/log/messages - it's working on my system. What I don't know is if those variables are also available to the oci8 module once it's loaded.
/Per Jessen, Zürich
Hi, tried your suggestion today, but it doesn't work. The module is not loaded at all when I comment out the variables on the init script. There should be a better way to integrate oci8 module.. For the time being I'll keep the modified init script and track the changes on future updates :s Regards, Ciro N�����r��y隊Z)z{.�ﮞ˛���m�)z{.��+�Z+i�b�*'jW(�f�vǦj)h���Ǿ��i�������
Verify that /etc/sysconfig/apache2 has "env" somewhere in the APACHE_MODULES="..." line.
If it is not, you can simply add it to the line, or run yast, network services, http server, [Server Mod] tab, scroll down and enable env.
create a new file:
/etc/apache2/conf.d/cio8.conf
In that file place any httpd.conf statements you want, including but not limited to:
SetEnv MYVAR=value...
SetEnv OTHERVAR=othervalue...
or maybe:
Is there any elegant-already-thought way of setting environment variables for apache2? (that means not touching /etc/init.d/apache2), i've added oci8 support for apache2 on a server and defined variables in '/etc/profile.d' which allows me to start apache2 with oci8 support, BUT if the server is restarted apache2 starts without oci8 module and I have to restart manually.
Regards, Ciro -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
-- No virus found in this incoming message. Checked by AVG. Version: 7.5.524 / Virus Database: 270.6.0/1604 - Release Date: 8/11/2008 5:50 AM
-- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
2008/8/11 Brian K. White
Verify that /etc/sysconfig/apache2 has "env" somewhere in the APACHE_MODULES="..." line. If it is not, you can simply add it to the line, or run yast, network services, http server, [Server Mod] tab, scroll down and enable env.
create a new file: /etc/apache2/conf.d/cio8.conf
In that file place any httpd.conf statements you want, including but not limited to: SetEnv MYVAR=value... SetEnv OTHERVAR=othervalue...
or maybe:
SetEnv MYVAR=value... </Directory> etc...
Then restart apache: rcapache2 restart
Even if it's just one line this is probably the most correct way to do it, because it's a seperate file you can blindly copy to new machines without worrying about existing files, and updates won't overwrite it.
Bear in mind: a few variables are not settable via SetEnv. PATH can not be set via SetEnv.
Bear in mind: when you manually run "rcapache2 restart", apache (and cgi scripts) picks up the PATH that you currently have while interactively logged in as root, which is entirely different from the PATH that apache gets when started by the rc scripts at boot. So to really test your settings, beleive it or not, reboot.
I have not yet discovered the best way to doctor apache's PATH in apache2 & opensuse.
-- Brian K. White brian@aljex.com http://www.myspace.com/KEYofR +++++[>+++[>+++++>+++++++<<-]<-]>>+.>.+++++.+++++++.-.[>+<---]>++. filePro BBx Linux SCO FreeBSD #callahans Satriani Filk!
----- Original Message ----- From: "Ciro Iriarte"
To: "opensuse" Sent: Monday, August 11, 2008 3:44 PM Subject: [opensuse] Apache2 and environment variables Is there any elegant-already-thought way of setting environment variables for apache2? (that means not touching /etc/init.d/apache2), i've added oci8 support for apache2 on a server and defined variables in '/etc/profile.d' which allows me to start apache2 with oci8 support, BUT if the server is restarted apache2 starts without oci8 module and I have to restart manually.
Regards, Ciro
Ok, tried using SetEnv inside and outside the <directory> tag and it didn't work, probably they are set, but it's too late to help apache load the oci8 module apparently.. Regards, Ciro -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Ciro Iriarte wrote:
Ok, tried using SetEnv inside and outside the <directory> tag and it didn't work, probably they are set, but it's too late to help apache load the oci8 module apparently..
If you just need the module auto-loaded, why not just add it to /etc/sysconfig/apache::APACHE_MODULES ? /Per Jessen, Zürich -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
2008/8/12 Per Jessen
Ciro Iriarte wrote:
Ok, tried using SetEnv inside and outside the <directory> tag and it didn't work, probably they are set, but it's too late to help apache load the oci8 module apparently..
If you just need the module auto-loaded, why not just add it to /etc/sysconfig/apache::APACHE_MODULES ?
/Per Jessen, Zürich
It's listed, but apparently the Oracle ORACLE_HOME, TNS_ADMIN and LD_LIBRARY_PATH variables are needed to load the module, they are defined in /etc/profile.d/oracle.sh, but only work when I login and start apache2, initialization after system reboot doesn't work... Regards, Ciro
----- Original Message -----
From: "Ciro Iriarte"
2008/8/11 Brian K. White
: Verify that /etc/sysconfig/apache2 has "env" somewhere in the APACHE_MODULES="..." line. If it is not, you can simply add it to the line, or run yast, network services, http server, [Server Mod] tab, scroll down and enable env.
create a new file: /etc/apache2/conf.d/cio8.conf
In that file place any httpd.conf statements you want, including but not limited to: SetEnv MYVAR=value... SetEnv OTHERVAR=othervalue...
or maybe:
SetEnv MYVAR=value... </Directory> etc...
Then restart apache: rcapache2 restart
Even if it's just one line this is probably the most correct way to do it, because it's a seperate file you can blindly copy to new machines without worrying about existing files, and updates won't overwrite it.
Bear in mind: a few variables are not settable via SetEnv. PATH can not be set via SetEnv.
Bear in mind: when you manually run "rcapache2 restart", apache (and cgi scripts) picks up the PATH that you currently have while interactively logged in as root, which is entirely different from the PATH that apache gets when started by the rc scripts at boot. So to really test your settings, beleive it or not, reboot.
I have not yet discovered the best way to doctor apache's PATH in apache2 & opensuse.
-- Brian K. White brian@aljex.com http://www.myspace.com/KEYofR +++++[>+++[>+++++>+++++++<<-]<-]>>+.>.+++++.+++++++.-.[>+<---]>++. filePro BBx Linux SCO FreeBSD #callahans Satriani Filk!
----- Original Message ----- From: "Ciro Iriarte"
To: "opensuse" Sent: Monday, August 11, 2008 3:44 PM Subject: [opensuse] Apache2 and environment variables Is there any elegant-already-thought way of setting environment variables for apache2? (that means not touching /etc/init.d/apache2), i've added oci8 support for apache2 on a server and defined variables in '/etc/profile.d' which allows me to start apache2 with oci8 support, BUT if the server is restarted apache2 starts without oci8 module and I have to restart manually.
Regards, Ciro
Ok, tried using SetEnv inside and outside the <directory> tag and it didn't work, probably they are set, but it's too late to help apache load the oci8 module apparently..
If you need to load a module then load a module Add this at the top of oci8.conf LoadModule oci8_module /usr/lib/apache2/mod_oci8.so Change the path & filename as appropriate. Similarly, add whatever else it takes to set up oci8. Any AddHandler, and Directory or Alias directives etc... StEnv are just environment variables because that's what you asked for. Maybe you need directives not environment variables? After the LoadModule, enclose everything that is oci8-specific (basically, everything else period) in: <IfModule mod_oci8.c> ...stuff... So that if the module load fails then at least Apache will still start up instead of crashing on invalid directives. Change the module name as appropriate there too. Surely all necessary apache httpd.conf directives and the exact file names are documented on some oci8 site somewhere, merely minus the opensuse particulars? -- Brian K. White brian@aljex.com http://www.myspace.com/KEYofR +++++[>+++[>+++++>+++++++<<-]<-]>>+.>.+++++.+++++++.-.[>+<---]>++. filePro BBx Linux SCO FreeBSD #callahans Satriani Filk! -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
participants (3)
-
Brian K. White
-
Ciro Iriarte
-
Per Jessen