View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0008321 | CentOS-7 | httpd | public | 2015-03-20 08:34 | 2020-07-22 14:10 |
Reporter | dansou901 | Assigned To | |||
Priority | normal | Severity | major | Reproducibility | always |
Status | new | Resolution | open | ||
Product Version | 7.1-1503 | ||||
Summary | 0008321: apachectl does not recognize variables in /etc/sysconfig/httpd | ||||
Description | Hi, in CentOS 6, I used to define Environment variables in /etc/sysconfig/httpd with bash Syntax (export variable = value). In CentOS 7, behaviour has slightly changed; now I just define a variable with variable=value. Problem is, when I want to use that variable in httpd config files, apachectl configtest doesn't recognize that I set the variable in /etc/sysconfig/httpd (but that file is sourced in apachectl script like this: if [ -r /etc/sysconfig/httpd ]; then . /etc/sysconfig/httpd fi) But: The httpd service starts up fine with the variable defined in sysconfig/httpd and used in httpd config files! So, please fix this, as we can't rely on the use of apachectl configtest anymore otherwise. Thanks! | ||||
Steps To Reproduce | 1. Define a variable in /etc/sysconfig/httpd like this: ServerIP=XXX.XXX.XXX.XXX 2. Use that variable in /etc/httpd/conf/httpd.conf 2.1 First use PassEnv: PassEnv ServerIP 2.2 Then use that variable in a Listen directive: Listen ${ServerIP}:80 or in a Vhost config: <VirtualHost ${ServerIP}:80> 3. Run apachectl configtest and receive the following: [Fri Mar 20 09:33:06.744139 2015] [core:warn] [pid 5772] AH00111: Config variable ${ServerIP} is not defined [Fri Mar 20 09:33:06.744208 2015] [core:warn] [pid 5772] AH00111: Config variable ${ServerIP} is not defined [Fri Mar 20 09:33:06.808926 2015] [core:crit] [pid 5772] (EAI 2)Name or service not known: AH00077: alloc_listener: failed to set up sockaddr for ${ServerIP} AH00526: Syntax error on line 46 of /etc/httpd/conf/httpd.conf: Listen setup failed 4. But systemctl start/restart httpd works fine! | ||||
Tags | apachectl, httpd, variables | ||||
abrt_hash | |||||
URL | |||||
We found out that apachectl still reads /etc/sysconfig/httpd in the way it did back in CentOS 6, while systemctl expects the variables without the word export before it. So apachectl has to be upgraded to be compatible to systemd. | |
If I split the line with the variable assignment first and the export second there is no error message and the variable is available in httpd.conf. | |
Date Modified | Username | Field | Change |
---|---|---|---|
2015-03-20 08:34 | dansou901 | New Issue | |
2015-03-23 10:11 | dansou901 | Tag Attached: httpd | |
2015-03-23 10:11 | dansou901 | Tag Attached: apachectl | |
2015-03-23 10:11 | dansou901 | Tag Attached: variables | |
2015-06-23 07:45 | dansou901 | Note Added: 0023451 | |
2020-07-22 14:10 | Arpit | Note Added: 0037394 |