Apache HTTPD Not Picking Up Environment Variables.

Home » CentOS » Apache HTTPD Not Picking Up Environment Variables.
CentOS 2 Comments

I’m trying to install DB2 on a CentOS 7 server. The problem I’m seeing is that the Apache httpd server fails to pick up the db2 environment variables. On an older version running under CentOS 5 this was done by inserting the following lines into the httpd start script in /etc/sysconfig/httpd:

if test -f /db2home/db2inst1/sqllib/db2profile; then
. /db2home/db2inst1/sqllib/db2profile fi

Under CentOS 7‘s systemctl system this no longer works. I need a clue as to where to start looking for where to put this so it will be sourced when the Apache server starts. I have googled this and can find nothing relevant. I even did a “find / -name httpd -print” and didn’t find anything looking promising.

Thanks for your help

Harold

2 thoughts on - Apache HTTPD Not Picking Up Environment Variables.

  • In non-systemd systems, httpd was started by a shell script
    (/etc/rc.d/init.d/httpd) which sourced the file /etc/sysconfig/httpd, so you could embed shell code in the file and it would be evaluated.

    In systemd systems, the httpd.service unit has:

    EnvironmentFile=/etc/sysconfig/httpd

    For systemd units, setting this will cause the systemd unit to read in the file for variables, but it ignores anything that isn’t a simple
    ‘foo