PHP - web hosting account name or root directory

Is there a call to a system function to show the root path.
In the end i need to plug in the username of the account, as in the example below

/home/THISUSERNAME/public_html/

it could even be the path to "this" file and i can then strip off the unneeded subdirectories manually

in order to programmatically generate a root path for PHP files

thanks
willsherwoodAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
maeltarConnect With a Mentor Commented:
This sill give you the document root..

echo $_SERVER['DOCUMENT_ROOT'];

Open in new window

0
 
mustang83Connect With a Mentor Commented:
$_SERVER["SITE_HTMLROOT"] will give the server root path.

This will only work if you site is not a virtual  or an alias in apache.

There is also dirname which might work

http://php.net/manual/en/function.dirname.php

0
 
mustang83Commented:
Here is a list of reserved variables that your might find handy.

http://php.net/manual/en/reserved.variables.server.php

0
 
willsherwoodAuthor Commented:
thanks all - the PHP filesystem root was what i was after
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.