Recommended way to use autotools

2009-11-16 Thread Dave Ingram

Hi all,

I've been wondering if there is a recommended way of using autotools 
when writing an Apache module? I've seen a tutorial 
 on 
this, but it was last updated in 2005, so I'm not sure if there are any 
better ways or things to do. I've also looked at a couple 
 of projects 
, and they seem to do things 
differently. I also found a couple of previous 
 questions 
 on this 
subject, but they're very old and don't answer my question.


I essentially want to allow the module to be compiled against one or two 
different libraries, depending on availability and user choice.


Non-essential background details:
8<-
I'm building a module that accesses a database at configuration parse 
time, but I can't use APR DBD for a few reasons. Firstly, I need 
features from apr-util 1.3 which is not in many major distributions. 
Secondly, apr-util and mod_php can conflict by linking against 
libmysqlclient_r and libmysqlclient, respectively. Both libraries export 
the same symbols, which then causes all sorts of hell (generally 
manifesting as bizarre segfaults). I've also had issues with the 
distro-packaged versions of apr-util being compiled without database 
support (or DSO support, making it impossible to load the DB drivers). 
Then again, this could be due to me missing something. My DB 
driver-loading code was inspired from mod_dbd, so I'm fairly sure it's 
making the right calls.


Basically, I want the user/package maintainer to be able to force 
selection of libmysqlclient/libmysqlclient_r as appropriate (as some 
distributions have fixed this issue), although it would be even better 
to autodetect this via "configure" rules. I then also plan to add 
support for other databases, such as Postgres.


Of course, if anyone has any better suggestions on how to do this that 
don't involve me writing my own reduced-functionality DB abstraction 
layer, I would love to hear them.

>8-


Thanks,


Dave


Re: MySQL Virtual Host and Traffic Module

2009-04-19 Thread Dave Ingram

Hi Eldho,

I'm the author mod_sqltemplate, which sounds like it does what you're 
after (as Jorge kindly pointed out). It's currently under mostly-active 
development, and I'm definitely open to bug reports and suggestions.



Dave


Eldho wrote:

Hi Vaughan,

What is the status of this module. Actually I am searching for a module 
that write all the vhost  configuration to a database and read it from db

also.

thanks.

Eldho



Dave Ingram wrote:
  

Hi Vaughan,


Thanks for the response. I haven't thought of doing the SQL query the way
you suggested, however I agree that it will cause unnecessary load on
busy
servers and I would like to keep this as efficient as possible.

The second option sounds more reasonable. I have already used threading
to
make a function which ticks on a configurable interval so I suppose each
child process would dump data for each of its vhosts at this interval,
using
a query similar to what you have suggested.
  
  
I think that's probably the most sensible approach. It does mean that 
you won't have up-to-the-moment statistics, and I would guess that you'd 
have to play about with different intervals as the number of hosts grows 
in order for it to scale. You may also want to consider somehow 
staggering the updates, so they don't all happen at once. It may also be 
advisable to perform an UPDATE rather than an INSERT... ON DUPLICATE 
UPDATE once your module knows that there is a value that can be updated 
(i.e. after the query has run once in the simple case, or once this 
day/hour/etc in the complex case).




I think I might go with the second option for the time being and see how
it
goes but I am still interested to know if there is a way to store per
vhost
data across children?
  
  
I would be interested to know how things turn out, and I'd be interested 
to see the final module. I've been thinking about writing a custom 
bandwidth monitoring/limiting module myself, but if I don't need to 
reinvent the wheel...


I'm afraid I can't answer this question in a definite way, though. One 
module that should store per-vhost data like this is mod_cband 
<http://sourceforge.net/projects/cband/>, so that might be worth looking 
into.


As a side note, I'd be interested to know how you create/template the 
virtual hosts. I myself have written a database-backed templating module 
that could be used for virtual hosting 
(http://www.dmi.me.uk/code/apache/mod_sqltemplate/) and I'm curious to 
see other approaches.


Thanks,


Dave



Thanks,
Vaughan

-Original Message-
From: Dave Ingram [mailto:d...@dmi.me.uk] 
Sent: Thursday, 19 March 2009 12:28 AM

To: modules-dev@httpd.apache.org
Subject: Re: MySQL Virtual Host and Traffic Module

Vaughan,

  
  

What I have so far are 2 filters which gather the inbound traffic and
outbound traffic for each transaction. These work ok and when logging
transactions to file all of the in/out byte amounts appear to be
correct.
The first problem however, is that each child has its own set of memory



and
  
  

therefore keeps its own totals per virtual host. This also means that
multiple logging events occur for each transaction. I could just log
this
all to database but it would 1) be inefficient and 2) cause the size of



the
  
  

database to grow quite quickly.
  



It sounds to me like you could go two ways with this. I don't know the
format of your database table, but it should be possible to update it
atomically using something like:

INSERT INTO bandwidth (vhost_id, bw_in, bw_out) VALUES (42, 1124,
5023409) ON DUPLICATE KEY UPDATE bw_in = bw_in + 1124, bw_out = bw_out +
5023409

but that could lead to a lot of load. Another way might be for each
child to collect statistics and only flush to the database periodically,
say every 30 seconds (perhaps configurable on a per-vhost basis, so that
load-heavy sites could have larger update intervals). It would still be
possible to use the query above though.

This query could probably even be updated to split statistics on a
date/time basis, if you require more granular reporting.

Or have I missed/misunderstood something?


Dave

  
  





  




Re: custom background thread and module sharing a data structure

2009-04-03 Thread Dave Ingram
Hi Sorin,

Sorin Manolache wrote:
> On Wed, Mar 11, 2009 at 02:08, Andrej van der Zee
>  wrote:
>   
>> Hi,
>>
>> I need to modify Apache and run one custom background thread. In addition,
>> my custom modules have to be able to share a data structure with this
>> background thread. Did anybody do this before? Is there an example I can use
>> as a starting point?
>> 
>
> Yes, I did this. I will send you a commented source file sometimes
> today or early tomorrow (Central European Time), I don't really have
> time now.
>   
I'm interested in something similar -- would you please send me some
example sources as well?

Thanks,


Dave


Re: APR feature detection

2009-04-03 Thread Dave Ingram
Sorin Manolache wrote:
> On Thu, Apr 2, 2009 at 19:45, Dave Ingram  wrote:
>   
>> Hi guys,
>>
>> Is there any way that my module can detect which APR features are
>> enabled in Apache? It relies on DBD, and if that's not available then my
>> module just segfaults, which isn't very friendly. I'd prefer to give an
>> error message to the user, telling them that DBD is required.
>>
>> Does anyone have any tips, or should I ask the APR list instead?
>> 
>
> dbd does this:
> APR_REGISTER_OPTIONAL_FN(ap_dbd_prepare);
> APR_REGISTER_OPTIONAL_FN(ap_dbd_open);
> APR_REGISTER_OPTIONAL_FN(ap_dbd_close);
> APR_REGISTER_OPTIONAL_FN(ap_dbd_acquire);
> APR_REGISTER_OPTIONAL_FN(ap_dbd_cacquire);
>
> APR_RETRIEVE_OPTIONAL_FN(one of the functions above) should give you
> NULL if DBD is absent.
>
> The two macros are declared in apr_optional.h.
>   

Actually, that's not quite what I was after -- those are defined by
mod_dbd, which I don't rely on (as it's initialised too late for my
module's purposes). I do all of the DBD interaction myself. Is there any
other way to be sure it's enabled? Would:

if (apr_dbd_open != NULL) {
  // error...
}

work?


Dave


Re: APR feature detection

2009-04-02 Thread Dave Ingram

Sorin Manolache wrote:

On Thu, Apr 2, 2009 at 19:45, Dave Ingram  wrote:
  

Hi guys,

Is there any way that my module can detect which APR features are
enabled in Apache? It relies on DBD, and if that's not available then my
module just segfaults, which isn't very friendly. I'd prefer to give an
error message to the user, telling them that DBD is required.

Does anyone have any tips, or should I ask the APR list instead?



dbd does this:
APR_REGISTER_OPTIONAL_FN(ap_dbd_prepare);
APR_REGISTER_OPTIONAL_FN(ap_dbd_open);
APR_REGISTER_OPTIONAL_FN(ap_dbd_close);
APR_REGISTER_OPTIONAL_FN(ap_dbd_acquire);
APR_REGISTER_OPTIONAL_FN(ap_dbd_cacquire);

APR_RETRIEVE_OPTIONAL_FN(one of the functions above) should give you
NULL if DBD is absent.

The two macros are declared in apr_optional.h.
  

Thanks Sorin -- just what I was after!


Dave


APR feature detection

2009-04-02 Thread Dave Ingram
Hi guys,

Is there any way that my module can detect which APR features are
enabled in Apache? It relies on DBD, and if that's not available then my
module just segfaults, which isn't very friendly. I'd prefer to give an
error message to the user, telling them that DBD is required.

Does anyone have any tips, or should I ask the APR list instead?

Thanks,


Dave


Re: MySQL Virtual Host and Traffic Module

2009-03-18 Thread Dave Ingram

Hi Vaughan,

Thanks for the response. I haven't thought of doing the SQL query the way
you suggested, however I agree that it will cause unnecessary load on busy
servers and I would like to keep this as efficient as possible.

The second option sounds more reasonable. I have already used threading to
make a function which ticks on a configurable interval so I suppose each
child process would dump data for each of its vhosts at this interval, using
a query similar to what you have suggested.
  
I think that's probably the most sensible approach. It does mean that 
you won't have up-to-the-moment statistics, and I would guess that you'd 
have to play about with different intervals as the number of hosts grows 
in order for it to scale. You may also want to consider somehow 
staggering the updates, so they don't all happen at once. It may also be 
advisable to perform an UPDATE rather than an INSERT... ON DUPLICATE 
UPDATE once your module knows that there is a value that can be updated 
(i.e. after the query has run once in the simple case, or once this 
day/hour/etc in the complex case).



I think I might go with the second option for the time being and see how it
goes but I am still interested to know if there is a way to store per vhost
data across children?
  
I would be interested to know how things turn out, and I'd be interested 
to see the final module. I've been thinking about writing a custom 
bandwidth monitoring/limiting module myself, but if I don't need to 
reinvent the wheel...


I'm afraid I can't answer this question in a definite way, though. One 
module that should store per-vhost data like this is mod_cband 
<http://sourceforge.net/projects/cband/>, so that might be worth looking 
into.


As a side note, I'd be interested to know how you create/template the 
virtual hosts. I myself have written a database-backed templating module 
that could be used for virtual hosting 
(http://www.dmi.me.uk/code/apache/mod_sqltemplate/) and I'm curious to 
see other approaches.


Thanks,


Dave



Thanks,
Vaughan

-Original Message-
From: Dave Ingram [mailto:d...@dmi.me.uk] 
Sent: Thursday, 19 March 2009 12:28 AM

To: modules-dev@httpd.apache.org
Subject: Re: MySQL Virtual Host and Traffic Module

Vaughan,

  

What I have so far are 2 filters which gather the inbound traffic and
outbound traffic for each transaction. These work ok and when logging
transactions to file all of the in/out byte amounts appear to be correct.
The first problem however, is that each child has its own set of memory


and
  

therefore keeps its own totals per virtual host. This also means that
multiple logging events occur for each transaction. I could just log this
all to database but it would 1) be inefficient and 2) cause the size of


the
  

database to grow quite quickly.
  



It sounds to me like you could go two ways with this. I don't know the
format of your database table, but it should be possible to update it
atomically using something like:

INSERT INTO bandwidth (vhost_id, bw_in, bw_out) VALUES (42, 1124,
5023409) ON DUPLICATE KEY UPDATE bw_in = bw_in + 1124, bw_out = bw_out +
5023409

but that could lead to a lot of load. Another way might be for each
child to collect statistics and only flush to the database periodically,
say every 30 seconds (perhaps configurable on a per-vhost basis, so that
load-heavy sites could have larger update intervals). It would still be
possible to use the query above though.

This query could probably even be updated to split statistics on a
date/time basis, if you require more granular reporting.

Or have I missed/misunderstood something?


Dave

  




Re: MySQL Virtual Host and Traffic Module

2009-03-18 Thread Dave Ingram
Vaughan,

> What I have so far are 2 filters which gather the inbound traffic and
> outbound traffic for each transaction. These work ok and when logging
> transactions to file all of the in/out byte amounts appear to be correct.
> The first problem however, is that each child has its own set of memory and
> therefore keeps its own totals per virtual host. This also means that
> multiple logging events occur for each transaction. I could just log this
> all to database but it would 1) be inefficient and 2) cause the size of the
> database to grow quite quickly.
>   

It sounds to me like you could go two ways with this. I don't know the
format of your database table, but it should be possible to update it
atomically using something like:

INSERT INTO bandwidth (vhost_id, bw_in, bw_out) VALUES (42, 1124,
5023409) ON DUPLICATE KEY UPDATE bw_in = bw_in + 1124, bw_out = bw_out +
5023409

but that could lead to a lot of load. Another way might be for each
child to collect statistics and only flush to the database periodically,
say every 30 seconds (perhaps configurable on a per-vhost basis, so that
load-heavy sites could have larger update intervals). It would still be
possible to use the query above though.

This query could probably even be updated to split statistics on a
date/time basis, if you require more granular reporting.

Or have I missed/misunderstood something?


Dave


Re: mod_vhost_dbd

2009-02-15 Thread Dave Ingram
Jorge Bastos wrote:
> Sorry about apxs.
>   
That's fine -- everyone has to learn somewhere.

> I'm just curious, libmysql shouldn't be linked agains the .so module
Nope - it uses the built-in APR DBD in Apache, which already links
against MySQL.


Dave


Re: mod_vhost_dbd

2009-02-15 Thread Dave Ingram
Jorge Bastos wrote:
> Dave,
> You could have a Install.txt file to explain how to compile.
> I'm not very familiar with apxs2 :)
>
> Can you post here?
>   

Erm. I think all you need to use is:

apxs2 -i -c mod_sqltemplate.c

as root, to compile and install in one step. Don't forget to add the
LoadModule line!


Dave


Re: mod_vhost_dbd

2009-02-15 Thread Dave Ingram
Jorge Bastos wrote:
>> This is possible using mod_sqltemplate. Suppose in your database, you
>> have a "php_register_globals" column, which is either "On" or "Off".
>> Then this will work:
>>
>> [snip]
>
> So I think my problem is resolved!
> Resuming, I can have as many columns I want in the hosts table, correct? If
> so, I can have the config I want!!! That's fantastic, I've been looking for
> something like this for some years!
>   
Yup. I place no restrictions at all. It doesn't even have to be a single
table -- it can be the result of a multi-table join, as long as all of
the columns have different names. They can be renamed using "AS", like
"SELECT a.id, a.name, h.name AS hname FROM table1 a, table2 h" for
example, which would then be accessed as ${id}, ${name}, ${hname}. Take
a quick glance at the sample configuration

from the mod_sqltemplate site.

>> You can tell Apache to perform a config reload (e.g. via apache2ctl
>> graceful), which will force the configuration to be re-read from the
>> database.
>> 
>
> Hum but this only via commandline correct?
>   
It can be from anything that can send Apache a signal (USR1 causes a
graceful restart) as well. Running apache2ctl can be done from anything
that has the right permissions to signal Apache.

As an incidental note, I'm planning on writing a PHP patch that allows
you to force Apache to do a graceful restart, but I haven't had the time
to think about the best way to do this yet.

> Another thing, apache read's this, when it loads and stays with this info on
> memory correct?
>   
That's correct.

> The existing virtualhosts that I have, I can leave that intact, and start
> using the new virtualhosts with this configuration, correct?
>   
You can leave your existing configuration files and create a completely
new one that handles all of your new virtualhosts.


Dave


Re: mod_vhost_dbd

2009-02-15 Thread Dave Ingram
Jorge Bastos wrote:
> Hi again Dave,
>
> Your is better than dbd!
>   
Thanks -- it's always nice to be appreciated. Let me know if you hit any
problems, as I don't have the resources to test it in lots of different
situations.

> I just see a problem for me, I have the need to tune values for php
> configuration, for example:
>
> Vhost 1, needs register_globals off (php_admin_value register_globals off)
> Vhost 2, needs register_globals on  (php_admin_value register_globals on)
>
> This is something that won't be possible at the moment.
> Did you ever think in a way to make this possible?
>   
This is possible using mod_sqltemplate. Suppose in your database, you
have a "php_register_globals" column, which is either "On" or "Off".
Then this will work:



# ...
php_flag register_globals ${php_register_globals}
# ...



> When I say this values for php, it may happen that other ones appear.
>   
You can use a similar method for any directives. You can even have fully
custom directives:



#...
${custom}
#...



In this case, the "custom" column can contain anything from an empty
string to a single directive, to a set of directives.

Does this help?

> Another question, when I delete/create a record in the DB, it's required a
> apache restart or it knows when a request is done?
>   
You can tell Apache to perform a config reload (e.g. via apache2ctl
graceful), which will force the configuration to be re-read from the
database.


Dave


Re: mod_vhost_dbd

2009-02-15 Thread Dave Ingram
Hi Jorge,

Something with the same name:

http://code.google.com/p/dbd-modules/wiki/mod_vhost_dbd


I don't know if that's what you're after, but I've written something
vaguely similar but more flexible:

http://www.dmi.me.uk/code/apache/mod_sqltemplate/


Hope this helps!


Dave


Jorge Bastos wrote:
> Hi people,
>
> I just signed up, to report a typo.
>
>  
>
> http://modules.apache.org/search.php?id=1753
>
>  
>
> the link is broken.
>
> I'd love to test this, I'm looking for it for some time.
>
> Is the maintainer out there? J
>
>  
>
> Jorge
>
>
>   



Re: Making mod_auth_digest mysql

2009-02-06 Thread Dave Ingram
The -f and -d flags for RewriteCond are for checking the file system,
not environment variables, although they can use environment variables
if necessary. For example:

RewriteCond %{DOCUMENT_ROOT}/%{ENV:foo} -d

would check that the folder named by the environment variable "foo"
exists in the document root.


Dave


Michele Waldman wrote:
> RewriteCond has flags -f -d ...
> But not -e for exists.
> It looks like:
> RewriteCond ${REMOTE_USER} !="" always evaluates to true if REMOTE_USER does
> not exist.  Am I wrong?
> I'm thinking about adding a -e flag for environment variable does not exist
> to httpd on my server.  It would return true if the variable exists or
> false, otherwise.
> Is there a way to already do this?
> Thoughts?
>
> Michele
>
>
>   



Announcement: mod_sqltemplate

2009-02-01 Thread Dave Ingram
Hi all,

A while ago, I discussed[1] the idea of a flexible SQL-based
configuration templating module for Apache 2.2. I've since written the
code, and (after letting it fall by the wayside for a couple of months),
I'm ready for people to test it, poke it and break it (and then send me
a bug report).

If you would like to help, then please visit my site[2] for information
on the module, its capabilities, and usage information. The source is
currently held in Subversion[3], so if there are any volunteers to just
check the code over and offer some advice/pointers/criticisms then that
would be very welcome. This is my first foray into APR, DBD, and Apache
module coding -- I want to make it as robust and well-coded as possible.

Thanks,


Dave

[1]
http://mail-archives.apache.org/mod_mbox/httpd-modules-dev/200808.mbox/%3c48a99724.50...@dmi.me.uk%3e
[2] http://www.dmi.me.uk/code/apache/mod_sqltemplate/
[3] http://svn.dmi.me.uk/mod_sqltemplate/trunk


Re: Logging authentication requests

2008-10-09 Thread Dave Ingram
To clarify:
> Is it currently possible to log authentication requests (ideally both
> success and failure, individually)? If not, is it possible?

Meant: is it currently possible to do this with Apache 2.2 (perhaps
using an existing module)? If not, is it even theoretically possible?


Dave


Re: Apache modification questions

2008-09-05 Thread Dave Ingram
Andrej van der Zee wrote:
> Does anybody know if the hook functions of such modules usually
> spawning a new thread/process? My guess is that at least for compiled
> CGI application written in C/C++ a new process is forked in the hook
> function.
>   

This is just off the top of my head, so I have no solid proof for this,
and please correct me if I'm wrong.

I would think that the reason for having an Apache module for PHP/Perl
would be to avoid the overhead of initialising the interpreter for every
page - it initialises itself once at Apache start, and then resets its
state for each request. Or so I would hope. Using a module also gives
them access to some Apache internals that CGI applications can't reach.
CGI applications (including mod_suphp and PHP/Perl run as CGI scripts)
would be forked.


Dave


Re: APR DBD: Column names from query

2008-08-31 Thread Dave Ingram
Vincent Bray wrote:
> 2008/8/29 Dave Ingram <[EMAIL PROTECTED]>:
>   
>> I presume you meant  and ? My basic plan at the
>> moment is essentially based upon mod_macro, with the necessary changes
>> to read from a database. I imagine that internally it works in a similar
>> way to the two  sections.
>> 
> Nick's referring to  literally. Its a new directive in trunk
> that uses SSI-like parsing in the config. See r644253 et al.
>   
Aha, thanks for that, Vincent. I had no idea that something like that
has been included. I don't tend to keep up with non-releases. I think
the expression parser might be useful for my own configuration
parsing-time conditionals, but I'm not sure that runtime checks like
that really fall under the scope of this project. It could be a powerful
combination, however.

My basic idea is to avoid having to automatically generate configuration
files via a script, and just have templated sections repeating in the
configuration.

Thanks, though -- it's something I'll keep an eye on.


Dave


Re: APR DBD: Column names from query

2008-08-29 Thread Dave Ingram
Nick Kew wrote:
> Dave Ingram wrote:
>
>> If you're interested, I've posted a bit more about it on my blog while
>> I'm still fleshing out the idea:
>> http://www.dmi.me.uk/blog/2008/08/13/modules-for-apache-and-php/
>
> OK, why doesn't your blog accept my attempt to comment?
> Among other things, I was trying to point you to 
> configuration sections, which should be background for
> your project.

Aha! Sorry, I've recently changed domains, so the reCAPTCHA key was no
longer valid. I'll fix that in the next half hour or so. Thanks for the
heads-up!

I presume you meant  and ? My basic plan at the
moment is essentially based upon mod_macro, with the necessary changes
to read from a database. I imagine that internally it works in a similar
way to the two  sections.


Dave


Re: APR DBD: Column names from query

2008-08-29 Thread Dave Ingram
Nick Kew wrote:
> Dave Ingram wrote:
>
>> First off, if this isn't the correct place to ask this then I apologise,
>> but it seemed the most appropriate list. If there's somewhere more
>> appropriate, please let me know.
>>
>> I've had a quick look for some information on accessing a database via
>> APR, and after glancing through the header files, I still have a
>> question: is it possible to get the column names from the query results?
>
> Yes, with sufficiently up-to-date versions of apr_dbd and mod_dbd.
> Hints about how it works can be found in the relevant CHANGES files.
>
> Sorry to be terse, but it would take too long to dig up URLs
> from here.
That's fine - all I really wanted was to know if it's possible, and a
nudge in the right direction -- thanks!

>> [snip - moved lower and improved]
>
> Interesting idea.  Are you familiar with mod_vhost_dbd, and even
> mod_macro, which do somewhat-related things?
Yes indeed, although I only used the VirtualHost example as it's the
most often-used. Unless I'm much mistaken, mod_vhost_dbd only allows you
to set the document root, and all other mass virtualhosting solutions
that I've seen are quite limited -- nowhere near this flexible.

Say you wanted to add some redirects to your virtual hosts too, after
the directories have been rearranged, for example... as far as I know,
no module allows you to do anything like this:



  DocumentRoot /www/root/path/$baz
  ServerName $bar
  ServerAdmin $qux
  
RedirectPermanent "$was" "$now"
  



If you're interested, I've posted a bit more about it on my blog while
I'm still fleshing out the idea:
http://www.dmi.me.uk/blog/2008/08/13/modules-for-apache-and-php/

I've been looking at mod_macro for inspiration and to see how it does
the substitution/re-parsing, and I think I may end up borrowing a few
chunks of its code to avoid re-inventing the wheel...


Dave


APR DBD: Column names from query

2008-08-29 Thread Dave Ingram
Hi all,

First off, if this isn't the correct place to ask this then I apologise,
but it seemed the most appropriate list. If there's somewhere more
appropriate, please let me know.

I've had a quick look for some information on accessing a database via
APR, and after glancing through the header files, I still have a
question: is it possible to get the column names from the query results?

Most of the answers from a Google search were to do with the Perl DBD
system instead... maybe I'm just not looking for the right thing? I
would have guessed that searches along the lines of
> apr dbd "column names"
would have worked, but sadly they didn't give me anything useful.

I admit that I could perhaps get this information from an existing
module that uses DBD, although I'm not really sure where I should start
looking, as I don't know of any modules that would care about the actual
column names. I'm sure it shouldn't matter, but the target database
(initially) is MySQL, so I could always fall back to calling the MySQL
functions directly with the native handle given to me by DBD if I had to.

If you want some context, then the reason I want to fetch column names
is to use them as substitution patterns in a configuration file, for
example:



  DocumentRoot /www/root/path/$baz
  ServerName $bar
  ServerAdmin $qux



... which is a very rough-and-ready example, but hopefully illustrates
my reasons.

Thanks,


Dave


Re: Configuration file templating

2008-08-19 Thread Dave Ingram
Hi Albert,

> Its not a module, but I've been working on a generic configuration
> file templating system to be powered by a variety of data sources,
> including SQL. You might enjoy checking it out:
>
> http://www.hypermagnet.com/
>   
Thanks for the information and link - I'll definitely have a look and
see if it serves my needs. At the moment, I use a set of scripts to
auto-generate the Apache configuration files (and for other things, like
BIND) and then to poke the daemons with SIGHUP (or equivalent) to
reload. I know BIND can be patched to read directly from a database --
I'd just prefer to skip the configuration file generation step for
Apache too if I can, while still maintaining flexibility :-)

If anyone's interested, I've put some preliminary information in a blog
post:
http://www.daveingram.me.uk/blog/2008/08/13/modules-for-apache-and-php/

Comments and criticisms welcome!

Thanks,


Dave


Configuration file templating

2008-08-18 Thread Dave Ingram
All,

I was wondering if anyone knew of any modules for configuration file
templating? I know there are some specific ones for virtual hosting, and
I know that there is mod_macro for other templating - but are there any
others that exist?

The reason I ask is that I'm planning on creating a templating module
that works via SQL queries, so that a configuration database can be
updated and Apache gracefully restarted to pick up the new
configuration. This module (mod_sqltemplate perhaps) would be as simple
and flexible as possible, and would of course be released to the
community under a BSD-style licence.

Obviously, I want to avoid re-inventing the wheel and save myself some
work if this has already been done! :-)

Thanks,


Dave Ingram