Reputation: 121
I have a tree which looks like this :
I've been trying to includes file.php from AnotherFile.php :
I get this error :
Eventhough my IDE doesn't warn that the file is not found.
Upvotes: 0
Views: 1155
Reputation: 23025
In instances like this, it's often better to use somewhat absolute paths instead of relative paths. You can make things easier with $_SERVER['DOCUMENT_ROOT']
to tell the code to start in your webroot instead of the system's root.
require_once($_SERVER['DOCUMENT_ROOT'].'/file.php');
Upvotes: 1