You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Christian Gross <Ch...@yahoo.de> on 2001/05/26 16:42:11 UTC

I am a bit confused about the configuration steps

I am writing a module and am seeing how things are loaded and the
configuration is read.  Consider the case of a dynamically loaded
module that has some command directives within the httpd.conf file.
Next consider the following sources from server/main.c

    ap_server_root = def_server_root;
    server_conf = ap_read_config(process, ptemp, confname,
&ap_conftree);
    ap_run_pre_config(pconf, plog, ptemp);
    ap_process_config_tree(server_conf, ap_conftree, process->pconf,
ptemp); 
    ap_fixup_virtual_hosts(pconf, server_conf);
    ap_fini_vhost_config(pconf, server_conf);
    apr_sort_hooks();
    if (configtestonly) {
	ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0,
NULL, "Syntax OK\n");
	destroy_and_exit_process(process, 0);
    }
    apr_pool_clear(plog);
    ap_run_open_logs(pconf, plog, ptemp, server_conf);
    ap_run_post_config(pconf, plog, ptemp, server_conf);
    apr_pool_destroy(ptemp);

According to this source I would guess that the httpd.conf file is
read (ap_read_config).  Then before any configuration is performed the
pre_config hooks are called.  Then the configurations are read and the
post_config hook is called.

But that is not what I am seeing happening in Apache.  In the
ap_read_config step my module is loaded and any command directive that
the module has are also read in at that point.  This means my command
directive is hit before the pre_config is hit.  It seems a bit
incorrect since I thought the pre_config hook was an initializer that
can be used to setup the module.  Right now I am using the
register_hooks function as an initializer.

Am I missing something here?

Christian Gross