You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Guille -bisho- <bi...@onirica.com> on 2002/05/05 21:14:14 UTC

Re: mass-hosting and DOCUMENT_ROOT

> >>My idea is to write my own apache-module, that does the host to path 
> >>translation and additionally set the DOCUMENT_ROOT variable. But before 
> >>I start, I would like to know (because you possibly have more knowledge 
> >>about the internal apache-design than me), if it is possible to set this 
> >>environment-variable in this phase so it takes effect in the later 
> >>content-processing. I tried to set the variable inside my 
> >>mod_perl-handler, but when the script I called through http was 
> >>executed, the standard-document-root appeared again.
> > 
> > This won't work because your setting will be overriden by the server's
> > core module. You have to either (1) tell your users not to use the
> > DOCUMENT_ROOT variable because it's a non-standard extension whose
> > value is often wrong; (2) do a quick-and-dirty hack to the core for
> > your installation; (3) fix it properly so that environment handling is
> > federated rather than under the core's control.
> 
> so what would be the prefered way for mass-hosting? I mean: All 
> virtualhost shall have the same properties, the log for all domains is a 
>   perl-script which saves the log-entry with the appropriate hostname, 
> which later is splitted. To recode big parts of apache is senseless, 
> since apache will be improved and my changes maybe wouldn't fit in 
> future releases. Besides the documentroot-problem: What is the best 
> (meaning most performant) way to configure apache with several hunderts 
> of domains and subdomains without having to reload apache with every change?

If you are providing PHP support, and you need DOCUMENT_ROOT to be set
correctly, yo can do the following:
- Put and ENV var with the hostname like DOCUMENT_ROOT_REAL
- Configure PHP to execute a prepend script before any other content
- In that script overwrite $_SERVER['DOCUMENT_ROOT'] with
$_ENV['DOCUMENT_ROOT_REAL'].

Surely a similar thing could be done with mod_perl.

In that way you don't have to worry about future changes in Apache.

-- 
        _     Guillermo Pérez    -=] 05/05/2002 [=-
       <·)     - bisho@ ( onirica.com | eurielec.etsit.upm.es )
       ( \>
bisho!  ""\\  ::                 Libertad en Internet.                ::