I'm trying to do some includes in my PHP file. Both the files I'm trying to include do off course exist.
This one works:
include("/folder/subfolder/firstfile.php");
This one doesn't:
include("/folder/secondfile.php");
How is this possible, since both includes are coming from the same folder.....?
The errors I'm getting
Warning: include(/folder/secondfile.php) [function.include]: failed to open stream: No such file or directory in index.php on line 2
Warning: include() [function.include]: Failed opening '/folder/secondfile.php' for inclusion (include_path='.:/usr/local/lib/php') in index.php on line 2
File structure
Root has folder
in it. The includes are made from a file that is in another folder in the root.
PHP extension is missing in the second include()
.
include("/folder/secondfile");
Change to
include("/folder/secondfile.php");
Also make sure that it is in folder folder
. If it is in subfolder
, don't forget to include it to path like :
include("/folder/subfolder/secondfile.php");