The solution is to create a basepath variable. The best way to do this is to include the following at the beginning of the script and then reference it
$basepath = dirname(dirname($_SERVER['SCRIPT_FILENAME'])).DIRECTORY_SEPARATOR;
Then you can reference the base path in your inclusion, required, etc. therefore
include "../myscript.php";
Would
include $basepath."myscript.php";
If you check the box again, you will have the following:
include "../../myscript.php";
Would
include $basepath."../myscript.php";
You must nest the dir_name functions twice, plus one more time for each additional folder for which you need to perform the return path. You MUST completely return to the folder where the symbolic link exists.
I consider this problem as a serious problem with PHP. I cannot come up with a single instance where it would be desirable to access reverse files relative to the actual file. In all situations, including shared hosting, it ONLY makes sense to go back along the connected path, and not to the target path.
John Pace II
source share