When using the include(), it is a good practice to use the $_SERVER['DOCUMENT_ROOT'] to get the root path and then get the include file path as relative to the root
such as
include($_SERVER['DOCUMENT_ROOT'] ."/myfilestobeincluded/file1.php");
So no matter the page will be moved to where, this include() will always pointing to the right path.
it is better than using the relative path only such as
include(../../myfilestobeincluded/file1.php);
My questions are
1) Am I right about the above statment?
2) If I am right, how do I handle the files to be included which is not in the webroot folder? in this case, using the root, $_SERVER['DOCUMENT_ROOT'], as the relative path will not work. Because the file I want to include is outside the wwwroot.
Thanks!