Re: Getting The Document Root

From: Date: Thu, 02 Feb 2006 13:25:36 +0000
Subject: Re: Getting The Document Root
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-229707@lists.php.net to get a copy of this message
Jeremy Privett wrote:
I'm looking for a method that would be able to extract the user's true document root (e.g. /home/jeremy/public_html/) so that I can use it for some filesystem scanning functions. I'm trying to avoid hard-coding supported document roots in favor of being able to dynamically detect it, but nothing is coming to mind. I thought I would consult some of the minds of the mailing list for advice. Any ideas or code would be greatly appreciated.
You can try with __FILE__ <quote from="http://php.net/manual/en/language.constants.predefined.php"> The full path and filename of the file. If used inside an include, the name of the included file is returned. Since PHP 4.0.2, __FILE__ always contains an absolute path whereas in older versions it contained relative path under some circumstances. </quote> and then use 'dirname()' http://php.net/manual/en/function.dirname.php Ciao! Silvio -- tradeOver | http://www.tradeover.net ...ready to become the King of the World?

« previous php.general (#229707) next »