Problems using include() from various directory levels
Posted: Thu Oct 02, 2003 2:44 pm
This question has already been asked on this forum, but I don't think the answer looked for was ever given.
I've created an auto-login script which I want to include in every possible entry page on my site. The problem that I'm having is that the auto-login script may be called from different directory levels. So, I've tried different ways of calling the include file:
In this example, say it's being called from
http://www.domain.com/A/test.php or
http://www.domain.com/A/subpath/test.php
include ('/B/file.php');
include ('B/file.php');
include ('./B/file.php');
include ('http://www.domain.com/B/file.php');
None of those work.
My site is on a Win2K machine with IIS. I've read that I can change include_path settings in the php.ini file, but what if I don't have access to it? Is that the only way to include a relative-path file?
I could go into every file and make sure I get the include file path prefix set manually, such as '../' or '../../'. This is what I'm trying to avoid doing. I already have a header file being included in every file, so it would be nice to add this include to just the header file. You'd think it'd work like calling an img src where you can just use img src="/images/whatever.gif".
Any help would be greatly appreciated!
I've created an auto-login script which I want to include in every possible entry page on my site. The problem that I'm having is that the auto-login script may be called from different directory levels. So, I've tried different ways of calling the include file:
In this example, say it's being called from
http://www.domain.com/A/test.php or
http://www.domain.com/A/subpath/test.php
include ('/B/file.php');
include ('B/file.php');
include ('./B/file.php');
include ('http://www.domain.com/B/file.php');
None of those work.
My site is on a Win2K machine with IIS. I've read that I can change include_path settings in the php.ini file, but what if I don't have access to it? Is that the only way to include a relative-path file?
I could go into every file and make sure I get the include file path prefix set manually, such as '../' or '../../'. This is what I'm trying to avoid doing. I already have a header file being included in every file, so it would be nice to add this include to just the header file. You'd think it'd work like calling an img src where you can just use img src="/images/whatever.gif".
Any help would be greatly appreciated!