[Modules] vhost_dbi and DOCUMENT_ROOT

Paul Querna chip at force-elite.com
Tue Feb 1 16:09:16 EST 2005


Nicklas Löf wrote:
> 
> 
> Hi again,
> 
> 
> I just wonder if this is a mistake or by design.
> 
> vhost_dbi doesn't seem to set the DOCUMENT_ROOT environment variable
> with the correct docroot-path. It does only modify the filename
> variable of the request_rec.
> 
> This makes apache2 to fail back to some default DOCUMENT_ROOT
> setting which is /htdocs, in Debian at least. I did discover this
> when suphp did stop to work and complained that the script wasn't in
> docroot(/htdocs).

I am afraid that it is currently not possible to set the DOCUMENT_ROOT 
environment in a clean way.  This variable is currently part of the 
server configuration structure, and changing it per-request is not safe.

It is not even possible to set it correctly in the fixups hook, since 
this var is set in ap_add_common_vars() and I believe mod_php calls this 
directly, overwriting the value of DOCUMENT_ROOT we could of set in the 
fixups hook.

On a side note, the DOCUMENT_ROOT env is non-standard and might be 
removed from future versions of Apache.

> Output from phpinfo() after I did move the test website to /htdocs:
> 
> vhost_dbi_PATH     /htdocs/ab/12/34/ab123456/public_html
> DOCUMENT_ROOT     /htdocs
> SCRIPT_FILENAME     /htdocs/ab/12/34/ab123456/public_html/test.php
> 
> 
> Another feature request would be the possiblity to set SERVER_ADMIN
> env variable.
> 

This can not safely done for the same reasons as above. (stored as part 
of he server record structure).

Sorry I couldn't be of more help,

-Paul



More information about the Modules mailing list