1

I have the following config included in my httpd.conf...

Include ${MODULE_DIR}/utilities/devconf/bo/vhost.conf

where ${MODULE_DIR} is an environment variable that I am setting in my httpd init script (/etc/init.d/httpd) like so:

MODULE_DIR=/export/home/modules

this line appears before the line that launches httpd.

Now when I attempt to start the Apache server using...

/etc/init.d/httpd start

I still get the following error:

[root@MyCentosVM ~]# /etc/init.d/httpd start
Starting httpd: httpd: Syntax error on line 1011 of /etc/httpd/conf/httpd.conf: Syntax error on line 1 of /etc/httpd/conf/devconf-vhosts.conf: Could not open configuration file /etc/httpd/${MODULE_DIR}/utilities/devconf/bo/vhost.conf: No such file or directory
                                                           [FAILED]
[root@MyCentosVM ~]#

... clearly the environment variable is not being substituted correctly. What do I do?

Xoundboy
  • 603
  • 1
  • 10
  • 21

1 Answers1

4

Try this instead:

export MODULE_DIR=/export/home/modules
quanta
  • 51,413
  • 19
  • 159
  • 217
  • Thanks for your response, however I don't think I am. The method I'm using is described in the answer by markdrayton in this post: http://serverfault.com/questions/64656/using-variables-in-apache-config-files-to-reduce-duplication – Xoundboy Sep 01 '11 at 13:43
  • I've updated my answer. – quanta Sep 01 '11 at 14:17
  • I just found the answer and came back to post it but found that you beat me to it :) Thanks – Xoundboy Sep 01 '11 at 14:35