Require_Once not working

gazzieh

New Member
Hi

I have the following code:

Code:
require_once("..\includes\incSentry.php");

The folder 'includes' exists, the file 'incSentry.php' exists and the PHP file that this code exists in is within a subfolder of the root address (called 'controls').

I get the following error message:

Warning: require_once(..\includes\incSentry.php) [function.require-once]: failed to open stream: No such file or directory in C:\Program Files\xampp\htdocs\[site]\controls\login.php on line 2

my Open_BaseDir is not enabled and so this cannot be the issue. I also have this piece of code working on another site without issue. I am stumped. Any ideas?
 

gazzieh

New Member
Ignore me!

The page with the require_once statement is called through an include statement on the main index page. This index page is at the root of the site whilst the offending statement is in a sub-directory and the required file is in another, separate sub-directory.

Quite simply, since it is included it's relative position is in the root of the site and NOT in the first sub-directory. Removing the redirect through ../ resolves the issue!
 
Top