perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jordan Michaels <jor...@viviotech.net>
Subject Re: Getting DocRoot of currently requested VirtualHost
Date Thu, 20 Oct 2011 23:39:10 GMT
Well, as what usually happens when you post to a mailing list and 
publicly ask for help, I figured it out. I am humiliated to admit that 
my problem was an apache configuration, so the DocRoot for the 
VirtualHost was resolving to the first VirtualHost's DocRoot instead of 
the proper VirtualHost's DocRoot. ::sigh::

This code:

my $document_root       = $r->document_root();

returns the proper docroot for the virtualhost as long as your apache 
settings are correct! A day wasted on something completely stupid!

Huge thanks to the folks that offered to help. Your support is deeply 
appreciated. =)

Warm regards,
Jordan Michaels

On 10/20/2011 03:04 PM, Jordan Michaels wrote:
> Hey Folks,
>
> I'm pretty new to mod_perl but not new to programming in general. I'm
> working on a mod_perl Apache module and I'm trying to find the way to
> get the Document Root of the Currently requested VirtualHost.
>
> I can get the currently requested domain name easily enough with:
>
> my $servername = $r->get_server_name();
>
> But getting the document root for that domain is proving to be a
> challenge with VirtualHosts.
>
> running this code:
>
> my $document_root = $r->document_root();
>
> Returns the first VirtualHost's document root, and not the document root
> of the domain that's being requested.
>
> I'm pretty sure I'm just missing something noobish here, but any
> pointers on how to go about getting the document root of the current
> requested VirtualHost would be *deeply* appreciated.
>
> Thank you in advance!
>

Mime
View raw message