Red Hat Bugzilla – Bug 147761
DOCUMENT_ROOT not set correctly when VirtualDocumentRoot is used
Last modified: 2008-02-15 01:34:22 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0
Description of problem:
I am writing a php script that indexes directories (a "directory indexer"). I have configured apache to use the VirtualDocumentRoot directive so it is easier to set up virtual hosts. While troubleshooting a problem with directories not being displayed correctly, I noticed that $_SERVER["DOCUMENT_ROOT"] is not set correctly-- in fact, it is set to "/etc/httpd/htdocs" which does not exist. I have not tested in a "normal" virtual host environment, but I "assume" the problem does not exist there.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. configure apache using VirtualDocumentRoot
2. call phpinfo() and examine value for $_SERVER["DOCUMENT_ROOT"]
3. on my machine it is /etc/httpd/htdocs which does not exist, and it is invalid.
Actual Results: wrong value for DOCUMENT_ROOT
Expected Results: correct value for DOCUMENT_ROOT
DOCUMENT_ROOT is just the value of the DocumentRoot setting; it's also not
affected by Alias etc. (VirtualDocumentRoot is much like a clever Alias).
Can you use SCRIPT_FILENAME or such instead?
in my case, SCRIPT_FILENAME is set to "/nfs/gate/common/directoryindex.php"
which is the filesystem path to the directory indexer script.
REQUEST_URI is set to, for example, "/projects". In order to access that
directory on the filesystem, I would normally prepend DOCUMENT_ROOT, but since
it does not have the right value I cannot do it that way.
I looked through all of the $_SERVER variables to see if there was something I
could prepend reliably to make this work, and DOCUMENT_ROOT is the only thing I
could come up with.
please let me know if you need more information-- I can attach httpd.conf and
directoryindex.php if that will help.
Fedora Core 1 is maintained by the Fedora Legacy project for security updates
only. If this problem is a security issue, please reopen and reassign to the
Fedora Legacy product. If it is not a security issue and hasn't been resolved in
the current FC5 updates or in the FC6 test release, reopen and change the
version to match.
NOTE: Fedora Core 1 is reaching the final end of support even by the Legacy
project. After Fedora Core 6 Test 2 is released (currently scheduled for July
26th), there will be no more security updates for FC1. Please use these next two
weeks to upgrade any remaining FC1 systems to a current release.
I have long since upgraded the host in question to FC4, and it has the same
issues with DOCUMENT_ROOT.
DOCUMENT_ROOT *should* be set to
'/nfs/zoidtechnologies.com/gate/<host>/<port>/html/', but instead it is
I've changed the version information on this bug so it is accurate.
Fedora Core 4 is not maintained anymore.
Setting status to "INSUFFICIENT_DATA". If you can reproduce this bug in the
current Fedora release, please reopen this bug and assign it to the
corresponding Fedora version.