On December 8, 2011 1:48 , Rui Hu <tchrb...@gmail.com> wrote:
2011/12/8 Rui Hu <tchrb...@gmail.com <mailto:tchrb...@gmail.com>>
Is $DOCUMENT_ROOT in php-cgi determined by ap_add_common_vars() in
Apache? It seems not to me. I commented the line 237 assigning
DOCUMENT_ROOT and re-compiled apache. php-cgi still works fine. It
seems that $DUCUMENT_ROOT in php-cgi is not determined by this
function.
What you say is correct. This is an Apache HTTP Server mailing list.
You said, "in apache, I cannot find any code which assign this var." and
I showed you where in Apache HTTP Server the DOCUMENT_ROOT environment
variable is set when running CGIs.
What you are now asking should be sent to the PHP users mailing list,
since it is a question about PHP. But, see the function
init_request_info() in the PHP source code, in the file
sapi/cgi/cgi_main.c (lines 1123-1137)
http://svn.php.net/viewvc/php/php-src/branches/PHP_5_3_8/sapi/cgi/cgi_main.c?revision=315335&view=markup
How PHP determines the value of $_SERVER[DOCUMENT_ROOT] depends on all
of the following:
- The value for the PHP directive cgi.fix_pathinfo
- The value for the PHP directive doc_root
- The value of the environment variable DOCUMENT_ROOT (set by Apache
HTTP Server)
--
Mark Montague
m...@catseye.org