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


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

Who is Participating?

Improve company productivity with a Business Account.Sign Up

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


Open in new window

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

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

willsherwoodAuthor Commented:
thanks all - the PHP filesystem root was what i was after
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.