Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- require_once fails if file already included
- Justin L. Kennedy
January 28, 2005, 7:15 am
rate this thread
A.php require_once on two files: B.php then C.php
C.php require_once on B.php again
Then I get a message:
Warning: main(../../B.php): failed to open stream: No such file or
/home/jkennedy/public_html/foo/php/secure/common/A.php on line
Fatal error: main(): Failed opening required '../../B.php'
in /home/jkennedy/public_html/foo/php/secure/common/A.php on
If I comment out the second require_once of B.php in C.php, the error goes
away and I still get the variables defined in B.php, so I know it is being
My question is why is it failing in the manner that it is doing? From
what I could tell in the manual require_once was supposed to do nothing if
it was already included. And why the "Failed opening", as if the file
I am using PHP 4.3.4.
Justin L. Kennedy
Georgia Institute of Technology, Atlanta Georgia, 30332