Hi,
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.
DocumentRoot
Servername
ServerAdmin
Customlog
ErrorLog
ServerAlias
ScriptAlias
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)
#file:ModPerl/VHost.pm
#-------------------------
package ModPerl::VHost;
use Apache::Constants qw(OK DECLINED);
use strict;
sub handler {
my $r = shift;
my $old_docroot = $r->document_root;
$r->document_root("/tmp");
return OK;
}
1;
But it returns (in the apache error log)
[error] [client 87.210.3.40] Usage: Apache::RequestRec::document_root(r) at /usr/lib/perl5/site_perl/ModPerl/VHost.pm 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 1.x?
I use apache Apache/2.0.52
Any help would be apreciated.
Regards,
Hans de Groot
Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.