You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Karyn Ulriksen <ku...@publichost.com> on 2000/03/28 23:32:02 UTC

RE: Set DocumentRoot from modperl

Sergio,

   I just walked this route...

   The long and short is that it can't be done anything close to feasably.

   You'll have to write your own URI Translator and alter some code so that
you can 
   introduce your DOCUMENT_ROOT down the line to things like the mod_cgi
etc.  If you 
   search the mod_perl forum, you'll see some handy code that one of the
gurus 
   around here provided me use the NOTES table.

   BTW, if you're introducing FrontPage to your masses.  You'll have to
re-write your 
   own fpcount.exe.  The codes not available and it's anybody's guess where
the hell 
   it actually gets the document root from (I even encoded it into the
mod_frontpage.c
   module without success) and naturally the source isn't available.

   Have fun.  I did!

---------------------------------------------------------------------
Best regards,

Karyn Ulriksen
Chief Systems Architect
PublicHost
22 Mauchly, Suite 200
Irvine, California  92618 USA
Phone: (949) 743-2000
email: kulriksen@publichost.com
URL:  http://www.publichost.com



-----Original Message-----
From: Serge <Serge Barbosa Da Torre [mailto:sergiobdt@yahoo.com]
Sent: Tuesday, March 28, 2000 1:45 PM
To: modperl@apache.org
Subject: Set DocumentRoot from modperl



Hi,
I am trying to find a way of setting DocumentRoot (and possibly Alias)
directly from modperl in order to implement dynamically generated 
virtual hosting.
The thing is that my virtualhost parameters comes from a database and
may change anytime (so I can't restart Apache in general), so it is 
difficult to implement with Apache virtual host rewrite, mod_rewrite 
or even <Perl> directives in httpd.conf.
I tried to use subprocess_env to set this variable, but it is useful
only for cgi-scripts, not perl or C handlers since it sets the Environment
variable only.

Is the only solution to rewrite the URI translation phase so it does not
use DocumentRoot directive??

-- 
Serge Barbosa Da Torre	-  sergiobdt@yahoo.com

"It's not easy, being green."
		-- Kermit the Frog

RE: Set DocumentRoot from modperl

Posted by Michael <mi...@bizsystems.com>.
> Sergio,
> 
>    I just walked this route...
> 
>    The long and short is that it can't be done anything close to
>    feasably.

There is a work around to this. If you use the syntax


perlcode
perlcode
require 'somefile.cgi';
more perl
more perl

then the cgi script gets imported into the environment and RUN with 
the current document root rather than the one for modperl for the 
whole system. Yeah, it's messy and require was not intended to be 
used quite that way, but it works!

> 
>    You'll have to write your own URI Translator and alter some code
>    so that
> you can 
>    introduce your DOCUMENT_ROOT down the line to things like the
>    mod_cgi
> etc.  If you 
>    search the mod_perl forum, you'll see some handy code that one of
>    the
> gurus 
>    around here provided me use the NOTES table.
> 
>    BTW, if you're introducing FrontPage to your masses.  You'll have
>    to
> re-write your 
>    own fpcount.exe.  The codes not available and it's anybody's
>    guess where
> the hell 
>    it actually gets the document root from (I even encoded it into
>    the
> mod_frontpage.c
>    module without success) and naturally the source isn't available.
> 
>    Have fun.  I did!
> 
> --------------------------------------------------------------------
> - Best regards,
> 
> Karyn Ulriksen
> Chief Systems Architect
> PublicHost
> 22 Mauchly, Suite 200
> Irvine, California  92618 USA
> Phone: (949) 743-2000
> email: kulriksen@publichost.com
> URL:  http://www.publichost.com
> 
> 
> 
> -----Original Message-----
> From: Serge <Serge Barbosa Da Torre [mailto:sergiobdt@yahoo.com]
> Sent: Tuesday, March 28, 2000 1:45 PM To: modperl@apache.org
> Subject: Set DocumentRoot from modperl
> 
> 
> 
> Hi,
> I am trying to find a way of setting DocumentRoot (and possibly
> Alias) directly from modperl in order to implement dynamically
> generated virtual hosting. The thing is that my virtualhost
> parameters comes from a database and may change anytime (so I can't
> restart Apache in general), so it is difficult to implement with
> Apache virtual host rewrite, mod_rewrite or even <Perl> directives
> in httpd.conf. I tried to use subprocess_env to set this variable,
> but it is useful only for cgi-scripts, not perl or C handlers since
> it sets the Environment variable only.
> 
> Is the only solution to rewrite the URI translation phase so it does
> not use DocumentRoot directive??
> 
> -- 
> Serge Barbosa Da Torre	-  sergiobdt@yahoo.com
> 
> "It's not easy, being green."
>   -- Kermit the Frog
>