Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: Module Loading Order for Apache 2 |
|
Author |
|
alexerwin
Joined: 24 Mar 2009 Posts: 14
|
Posted: Sun 12 Jul '09 5:14 Post subject: Module Loading Order for Apache 2 |
|
|
Hi,
I am having some trouble. Mod_Rewrite is loading and executing before Mod_Security and a custom module I wrote. I need variables set by Mod_Security and my custom module for Mod_Rewrite.
Not sure which configuration file you need me to post
Thanks |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Thu 13 Aug '09 20:19 Post subject: |
|
|
A maybe nerfing solution is to start apache in debug mode so you can see when which module loads. I'm note sure if it makes a difference to change the loading order in httpd.conf |
|
Back to top |
|
glsmith Moderator
Joined: 16 Oct 2007 Posts: 2268 Location: Sun Diego, USA
|
Posted: Thu 13 Aug '09 21:39 Post subject: |
|
|
It does look like they load in order to me |
|
Back to top |
|
tdonovan Moderator
Joined: 17 Dec 2005 Posts: 611 Location: Milford, MA, USA
|
Posted: Fri 14 Aug '09 4:21 Post subject: |
|
|
If you assign something to the environment variable SHOW_HOOKS and then start Apache from the command line, it will display the sorting of modules for each hook. Note that this is an OS-environment variable that you set on the command line, not an Apache-environment variable that you set in httpd.conf.
For example: Code: | SET SHOW_HOOKS=1
httpd.exe -t |
If you use mod_info, another way to see this is to browse to http://localhost/server-info#request_hooks.
In your custom module code, you should pass a NULL-terminated string array of the modules that you want to load before and after your module in your call to ap_hook_whatever. For example, if you use the "fixups" hook: Code: | static const char * const aszPre[] ={ "mod_security2.c", NULL };
static const char * const aszPost[]={ "mod_rewrite.c", NULL };
ap_hook_fixups(my_fixup, aszPre, aszPost, APR_HOOK_MIDDLE); |
Nick Kew's book on Apache Modules explains this stuff well. Recommended if you want to write your own Apache modules.
-tom- |
|
Back to top |
|
|
|
|
|
|