Click to See Complete Forum and Search --> : Windows include problem


biggus
03-24-2004, 10:09 AM
Have Apache 1.3 on my Win98 box. All is running fine, even virtual hosts. What I'm having trouble with is including other php and inc files using the following syntax:

include "/inc/fileToInclude.inc";

When I use this path, I get the following error:

Warning: main(): Failed opening '/inc/tables.inc' for inclusion (include_path='.;c:\php4\pear')

But the include path in my php.ini file is commented out and doesn't look like that in the first place. Anyone know what's going on?

Thanks,
Biggus

cosminb
03-24-2004, 11:48 AM
loose the first / from

include "/inc/fileToInclude.inc";
//try this instead:
include "inc/fileToInclude.inc";

biggus
03-24-2004, 11:47 PM
thanks, but removing the first slash works fine, of course, if the "inc" directory is in the same directory as the file trying to get at it. But when the file is in a lower directory as in:

/inc/constants.inc (includes folder, file to be included)
/index.php (no starting slash works fine)
/about/about.php (doesn't work)


The reason I need this, is because I have a generic header and footer to include in all files, regardless of where they sit. If I can reference the images directory in html by simply using

img src='/images...'

then you'd think I could do an include the same way in PHP.

Thanks again,
Biggus