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


--
  Mark Montague
  m...@catseye.org

Reply via email to