Question:
PHP Include Issues.?
Mark Schultz
2007-03-20 14:38:03 UTC
I get the following error messages on the page that I want the file to display:

Warning: main(../test.php) [function.main]: failed to open stream: Datei oder Verzeichnis nicht gefunden in /usr/export/www/hosting/invaderzimonline/izo/sozo.php on line 138

Warning: main() [function.include]: Failed opening '../test.php' for inclusion (include_path='.:') in /usr/export/www/hosting/invaderzimonline/izo/sozo.php on line 138

I have no idea what they mean, or what I'm doing wrong, I hardly know anything about PHP Include. Can someone enlighten me?
Three answers:
caseysoftware
2007-03-20 14:54:22 UTC
You can go the full path route as noted or you can include the url's relative from the first include. For example, if you have:



fileA.php

/includes/fileB.php

/includes/fileC.php



And fileA includes fileB, it would reference the "includes/" folder. If fileB includes fileC, then you would also need to use the "includes/" because it is considered from the fileA place.
romulusnr
2007-03-20 14:42:17 UTC
use the full path to the test.php in the include statement.
LorettoBoy
2007-03-20 15:41:13 UTC
drop the ../ in your include statement.



I bet your include file is in the same directory. You are referencing one directory up (the parent directory).


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...