httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Montague <>
Subject Re: questions about document_root
Date Thu, 08 Dec 2011 04:55:19 GMT
On December 7, 2011 23:23 , Rui Hu <> 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 

See line 237,

   Mark Montague

View raw message