|Pathologically Eclectic Rubbish Lister|
mod_perl PerlMapToStorageHandlerby sgifford (Prior)
|on Oct 11, 2009 at 22:17 UTC||Need Help??|
sgifford has asked for the
wisdom of the Perl Monks concerning the following question:
I'm looking at using a Perl module to dynamically set up some virtual hosts at run-time.
mod_perl is what I'm looking at, of course, and PerlMapToStorageHandler seems like just about what I want. I can look up the user information in the database based on $r->hostname(), find their home directory, then call $r->filename($new_path) to set up the mapping. If I can get this to work, I'll cache the results, so I won't have to hit the database very often.
But, that method doesn't seem to work like I expect it to. Just to test, I wrote this sub, which should cause all requests to return test.txt:
Instead, I get this in the error log:
and a 404 error in the browser.
The background is I'm working on a clustered environment with virtual hosts that are added from a Web interface. I'd like to be able to set up new virtual hosts by adding to the database and having Apache pick them up automatically, without the Web interface script having to arrange for the cluster of Web servers to be restarted. If somebody has a better idea for solving this problem, please let me know.
Updates: A few things other Monks have asked below that I should have included in the original.