Forum Moderators: coopster
// functions.php
function customInclude() {
include($_SERVER['DOCUMENT_ROOT'] . '/myfile.php');
}
I get this warning:
Warning: include(/var/www/path/root/myfile.php) [function.include]: failed to open stream: No such file or directory in /var/www/path/root/includes/functions.php on line 140
...but that is the correct path to the file, so why is it saying it can't find it?
P.S. Why does the BB code formatting suck so much here?
you could try echo'ing the path in that file and see what you get
you could try the relative include to see if that works, just for the sake of it
I have tried echoing the path, and it is correct. I don't understand why it can't be found.
Are there any limitations with including within a function? Is it a scope issue?