httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sorin Manolache <sor...@gmail.com>
Subject Re: Read file file before web server startup
Date Tue, 13 Nov 2012 06:48:49 GMT
On 2012-11-13 00:41, Idel Fuschini wrote:
> Hi,
> I need to read a configuration file (XML) and put dati in hash array before
> the webserver starts.
> It's possibile, if yes how ?

You define a module configuration object using the create_server_config 
callback of your module structure.

You define a configuration directive that specifies the name of the XML 
file (see the command_rec array of the module structure). In the 
command_rec array entry that defines your configuration directive, you 
associate the configuration directive with a callback function. The 
callback function is called when apache encounters the directive.

The argument of the configuration directive (in your case the XML file 
name) is passed by apache as an argument to the callback function.

You get the configuration object in the configuration directive callback 
using the ap_get_module_config function. You read the XML file in the 
callback function and initialise the configuration object.


Sorin


Mime
View raw message