In many places in my code, I do things like:
file1.php:
<?php
include('../file2.php');
file2.php:
<?php
include('anotherdirectory/file3.php');
Depending on the server or settings I try this on, it either sets the relative paths from the "includer" or from the "includee". This is really confusing. So file1 might try to include "../anotherdirectory/file3.php" or it might try "anotherdirectory/file3.php".
What settings dictate this behavior? I want to have control over this...
In cases when I need to use relative paths I use the following syntax:
include (realpath(dirname(__FILE__)."/another_folder/myfile.php"));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With