Issue
I have edited Apache so that my document root is here:
/var/www/html/Code/web/
But now I want to point to a file that is inside the ~/Code/
folder.
Normally I could use:
include($_SERVER['DOCUMENT_ROOT'] . '/Controllers/MyFile.php');
But that won't work with this new document root. So, without changing my document root, how can I point back to a folder that is in this path:
/var/www/html/Code/Controller/
Solution
Use ../
to up one directory.
include($_SERVER['DOCUMENT_ROOT'] . '/../Controllers/MyFile.php');
Answered By - Al Amin Chayan Answer Checked By - Senaida (WPSolving Volunteer)