[SOLVED] - Return the path above httpdocs/public_html - one before DOCUMENT_ROOT

Posted one year ago

If you’re after returning the path before public_html or httpdocs like so

/home/domain

Rather than

/home/domain/public_html

Use DOCUMENT_ROOT in conjunction with dirname();

dirname($_SERVER["DOCUMENT_ROOT"]) // returns /home/domain