Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I wonder, is there any possibility to find which .conf files apache is using at runtime? Some environment variable maybe, as it should work both windows and linux. Or php function?

share|improve this question

2 Answers 2

If you run

/usr/sbin/apachectl -V

you will see

-D HTTPD_ROOT="/etc/httpd"

and

-D SERVER_CONFIG_FILE="conf/httpd.conf"

which when combined will tell you the default location for the config file on a unix machine.

There's no apachectl for windows, but this posting indicates something similar might be possible by calling the apache executable directly with the proper arguments.

share|improve this answer
    
The real problems are Includes as they can be nested, and thus requiring a (potentially infinite) recursive scan to detect the full set of configs that get read in. It's fairly easily scriptable as long as your Includes structure does not create loops: grep through the main httpd.conf, find paths to Includes, grep through that newfound include, keep until grep returns zero results or you're visiting a file that you've visited before. –  Marcin Jan 18 '11 at 23:14

At runtime - no way. I would run

strace httpd | grep conf

(replace httpd by the mpm binary you're using, like httpd.worker or just httpd)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.