perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hans de Groot <>
Subject Mod_perl and (mass) virtual hosting or a mod_vhost alternative
Date Fri, 10 Nov 2006 20:01:11 GMT

I would like to make my own vhost modules in modperl.

I tried some other modules but I cannot seem to get them to work or they do
not support enough options.

I want to put virtual host infomation in a mysql database so I can let my modules decide
what virtual host we need.


And if possible the Directory directive and I would like to be able to configure
if this site can use php, embedded perl etc..

I have been searhing for days and been reading the "writing apache modules with perl and c"
form O' reilly
but I am really stuck. I

I found several examples for changing the document root, but it does not work with my setup.
The examples nver seem to mention in what phase you need to do this.
I am guessing I need to change these things in the PerlPostReadRequestHandler phase.

This is what I have tried (just to change the document root)

package ModPerl::VHost;
use Apache::Constants qw(OK DECLINED);
use strict;
sub handler {
 my $r = shift;
 my $old_docroot = $r->document_root;
  return OK;

But it returns (in the apache error log)

[error] [client] Usage: Apache::RequestRec::document_root(r) at /usr/lib/perl5/site_perl/ModPerl/
line ....\n

It seems I can read but not write.

So my questions are:
Is it at all posible to do this with mod perl?
What phase should I use to change these directives?
Can anyone give me some example how to do this?

I do not need or like mod_vhost_alias or solutions like that and I need to do this on the
fly, so when I add a new site to my
database it is online right away without restarting apache.

I think I am using mod_perl/1.99_16. Is that the same as mod_perl 2.x? or is it still mod_perl
I use apache Apache/2.0.52

Any help would be apreciated.


Hans de Groot

View raw message