Page 1 of 1

Get root directory path of site from php in subdirectory

Posted: Fri Jun 06, 2008 6:48 pm
by ripper
Hello:

I need get root of my server from php script in a subdirectory of site.

Example: php scritp in http://www.mysite.net/projects/gallerie ... source.php or http://localhost/Site/projects/gallerie ... source.php (in design time), this script get one variable from flash movie, the flash variable send to php script is the name of a directory at root of my site, example: flash send directory name "images" from a movie locate at http://localhost/Site/projects/galleries/gallery1, but this movie was loaded from main application in flex.

When I send "../../../images" all ok, php script list directories at this path, but I need have free application of location of site or movie, I want use, inside the php script, php variable for get root of my site, local or internet.

'DOCUMENT_ROOT' : The document root directory under which the current script is executing, as defined in the server's configuration file, Not for me.

Exists a php function or variable for get real root of my site, example: I need get some like http://localhost/ or http://www.mysite.net/ from php script executed at any subdirectory of my site.

Any Help?

Thank in advance

Re: Get root directory path of site from php in subdirectory

Posted: Sat Jun 07, 2008 9:25 am
by hansford
$root = $_SERVER['DOCUMENT_ROOT'];