You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@httpd.apache.org by bu...@apache.org on 2013/07/06 04:48:14 UTC

[Bug 26052] DOCUMENT_ROOT environment variable set incorrectly with VirtualDocumentRoot

https://issues.apache.org/bugzilla/show_bug.cgi?id=26052

--- Comment #44 from Mark <ma...@manngo.net> ---
(In reply to Kiall Mac Innes from comment #27)
> I've worked around this bug by creating a file with the following:
> 
> <?php 
> $_SERVER['DOCUMENT_ROOT'] =
> str_replace($_SERVER['SCRIPT_NAME'],"",$_SERVER['SCRIPT_FILENAME']); 
> ?>
> 
> And I use:
> 
> <VirtualHost 123.123.123.123>
> VirtualDocumentRoot /path/to/sites/
> ...
> php_admin_value auto_prepend_file /path/setdocroot.php
> </VirtualHost>
> 
> Also - this should work in a .htaccess file (untested):
> 
> php_flag auto_prepend_file /path/setdocroot.php

I found this advice the simplest. However the .htaccess file should contain
something like:

    php_value auto_prepend_file webroot.php

(ie php_value, not php_flag)

I have also modified it as follows to be less intrusive on the $_SERVER
variable, and to add another convenient global:

    //    webroot.php
    //    Save in same directory as .htaccess

    <?php
        $root = $_SERVER['WEB_ROOT'] =
str_replace($_SERVER['SCRIPT_NAME'],"",$_SERVER['SCRIPT_FILENAME']);
    ?>

Mark

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org