Re: Document root, preferred way to find it???

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Tom Rogers wrote:
Hi,

Thursday, March 3, 2005, 5:21:58 AM, you wrote:
A> I've been using in my scripts $_SERVER['DOCUMENT_ROOT'] to find the base path
A> for includes, etc.

A> We just moved the site to a new virtual host and it doesn't work.  print_r()
A> gives me:


$_SERVER['document_root']= /usr/local/apache/htdocs
$_SERVER['path_translated']= /home/user/public_html/


A> What do you guys use for you docroot?

If path_translated exists use that as it indicates a virtual website,
otherwise use document_root


If I'm reading you correctly, then a truly transportable include might look like this:


$doc_root= (isset($_SERVER['path_translated'])? $_SERVER['path_translated'] : $_SERVER['document_root'];

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux