capacheapache2apache2-module

How to programmatically obtain the apache2.conf file directory or path inside a module?


I have a module that is hooking ap_hook_child_init. From that callback I would like to obtain the directory where the main apache2.conf file lives (or the full path to that file, I'll parse out the directory).

That callback takes a server_rec struct and a apr_poot_t struct. server_rec has a path member, but it is null.


Solution

  • You can't find this directly, and of course "apache2.conf" may not exist at all. This file is a debian-ism.

    However, one option you have is to:

    Multiple modules can share the same directive name and they all get called to process it.