httpd-bugs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 26052] DOCUMENT_ROOT environment variable set incorrectly with VirtualDocumentRoot
Date Sat, 06 Jul 2013 02:48:14 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=26052

--- Comment #44 from Mark <mark@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


Mime
View raw message