2011/12/8 Rui Hu <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. > > I looked up php's code, php-cgi gets DOCUMENT_ROOT in following codes: > > /* DOCUMENT_ROOT */ > value = lstFset_get(rc->t->vars, "docroot"); > if (value != NULL) > php_register_variable("DOCUMENT_ROOT", value, track_vars_array > TSRMLS_CC); > > It gets docroot from a k-v table and the key is "docroot". In above code, > rc->t is a variables of httpTtrans. > > > 2011/12/8 Mark Montague <m...@catseye.org> > >> On December 7, 2011 23:23 , Rui Hu <tchrb...@gmail.com> wrote: >> >>> I looked up the code of PHP and apache2, and found that PHP gets docroot >>> from environment var "$DOCUMENT_ROOT". However in apache, I cannot find any >>> code which assign this var. >>> >>> I googled but got nothing. Can you please show me the detailed process >>> generating $DOCUMENT_ROOT in $_SERVER from apache to php. Thank you very >>> much! >>> >> >> If you invoke PHP as a CGI, then Apache HTTP Server sets DOCUMENT_ROOT in >> the function ap_add_common_vars() which is in the file server/util_script.c >> >> See line 237, >> >> https://svn.apache.org/viewvc/**httpd/httpd/branches/2.2.x/** >> server/util_script.c?revision=**1100216&view=markup<https://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/server/util_script.c?revision=1100216&view=markup> >> >> >> -- >> Mark Montague >> m...@catseye.org >> >> > > > -- > Best regards, > > Rui Hu > > ---------------------------------------------------------------------------------------- > State Key Laboratory of Networking & Switching Technology > Beijing University of Posts and Telecommunications(BUPT) > MSN: tchrb...@gmail.com > > ----------------------------------------------------------------------------------------- > > >
-- Best regards, Rui Hu ---------------------------------------------------------------------------------------- State Key Laboratory of Networking & Switching Technology Beijing University of Posts and Telecommunications(BUPT) MSN: tchrb...@gmail.com -----------------------------------------------------------------------------------------