Forum Moderators: coopster

Message Too Old, No Replies

Include can't find the path

Going crazy to know why

         

neophyte

1:01 am on Jun 19, 2006 (gmt 0)

10+ Year Member



I can't for the life of me figure out why this won't work:

got an include statement that goes:

include '_boilerplate/months.inc.php';

but it can't seem to find the file?

Have checked and rechecked the spelling of the directory (_boilerplate) and file name (months.inc.php) and that's fine.

Now, if I drop the include file months.inc.php into the root of the directory (same directory as the calling file), presto! perfect.

I've got other calling files with includes which reside other directories at the same level as "_boilerplate" that work (i.e. '_include_login/validate_login.php'), so I'm really at a loss why my call to '_boilerplate/months.inc.php' won't work.

Anyone got any ideas?

Neophyte

alce

3:42 am on Jun 19, 2006 (gmt 0)

10+ Year Member



I don't know for sure what is causing your problem but it might be a good idea to keep all your included files in one same location.

Set your includes path either in php.ini or in a .htaccess file and then every time you need to include a file, you do not need to specify a path regardless of where in your file hierarchy the calling file is:

include "file.php";

If you have many included files and want to further organize them, you can create subdirectories inside your default includes directory and then call:

include "file.php"; //for a file at the top level of your includes dir
include "somesubdir/file2.php"//for a file inside a subdirectory

by doing so you can get rid of the .inc extension since you know all files contained within your includes directory are included files && there should't be any scattered around.