I've got a directory structure similar to the following:
/home/gabriel/public_html/ -> ./includes
-> ./config
I have a file /home/gabriel/public_html/index.php, which wants to include the file
/home/gabriel/public_html/includes/blocks.inc.php
Now, blocks.inc.php wants to include /home/gabriel/public_html/config/settings.conf.php.
So, blocks.inc.php has a line something like require_once('../config/settings.conf.php'); However, when a user visits the website, going to site/~gabriel/index.php, it tries to include the file /home/gabriel/settings.conf.php, because its trying to include from the CWD of index.php, even though the include statement is in a file inside the ./includes directory!
So, my question is, is there a way to set it up so that PHP, when reading includes/requires, tries to open files based on the CWD/path of the exact calling file, instead of the CWD/path of the primary file being opened?
If not, how would you suggest I go about setting up these includes, because many files are trying to include numerous files in different directories, and those included files also have their own includes, making it somewhat complex.
Any suggests are very appreciated