How to pass parameters to an Apache Module from httpd.conf?

Posted on 2002-06-12
Last Modified: 2010-03-04
I'm trying to figure out how to pass parameters from the httpd.conf file to an apache module initialization routine. All of the examples I can find do not do this, and most do not have an explicit initialization routine.

The init routine signature is:

static void initialize( server_rec *s, pool *p );

The server_rec is passed to the initialize method, so my question is there any way to add initialization parameters to the httpd.conf of apache, and have them show up in the server_rec?

Question by:magenta
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 15

Accepted Solution

samri earned 200 total points
ID: 7093098

Gee... almost a week and nobody ever look in here :)

Up front, I do not have any knowledge in C (or C++) programming.  However I would try to give some pointers that might get you moving.
--enough the disclaimer.

One possible alternative is to look at the exising Apache modules (  Most of the modules do have the source code tarball.  And I noticed that in the example httpd.conf (or .htaccess) usage, there is thing like "SetPerlVar  var value", I think this should be the way parameters are passed to the modules, and in the module coding, there should be a way to retrieve this information back.


I hope *some* of the info might be useful.


Author Comment

ID: 7093521
That is interesting, I belive that SetPerlVar used in the httpd.conf sets a variable that is somehow set in the perl environment, so when your perl module runs, it can then pick it up. It's sorta like global variables. Kinda of a kludge but functional...

Unfortunately, my apache modules written in C, not perl. And I've looked at dozens of apache modules and most if not all don't even do initialization, let alone any kind of parameter passing from

LVL 15

Expert Comment

ID: 9690959
No comment has been added lately, so it's time to clean up this TA.

I will leave a recommendation in the Cleanup topic area with the following recommendation for this question:


Please leave any comments here within the next seven days.


EE Cleanup Volunteer

Featured Post

Transaction Monitoring Vs. Real User Monitoring

Synthetic Transaction Monitoring Vs. Real User Monitoring: When To Use Each Approach? In this article, we will discuss two major monitoring approaches: Synthetic Transaction and Real User Monitoring.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction As you’re probably aware the HTTP protocol offers basic / weak authentication, which in combination with the relevant configuration on your web server, provides the ability to password protect all or part of your host.  If you were not…
If you are running a LAMP infrastructure, this little code snippet is very helpful if you are serving lots of HTML, JavaScript and CSS-related information. The mod_deflate module, which is part of the Apache 2.2 application, provides the DEFLATE…
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question