[thelist] managing php include dependencies?

kasimir-k kasimir.k.lists at gmail.com
Wed Apr 11 14:21:12 CDT 2007

Ivo scribeva in 11/04/2007 16:36:
> In status.html: constant not yet set TEST_CONSTANT is: TEST_CONSTANT
> In configuration.php: set constant TEST_CONSTANT to: "**a test string**"
> In status.html: set constant TEST_CONSTANT is:  "**a test string**"
> In selector.php: constant TEST_CONSTANT is: **a test string**
> In logger.php" constant TEST_CONSTANT is: TEST_CONSTANT
> --
> status.html, selector.php & logger.php use include_once('configuration.php')

Based on this, to me it seems pretty clear that logger.php is in a 
different directory than the other files, and configuration.php can not 
be found from its directory with your include_path.

But why are you using include_once in the first place, if the file 
contains something that you *must* have included? In those cases you 
should use require_once, which will produce a fatal error if the file 
could not be included - then you very much know, where the inclusion 
does not happen. Include will only give you a warning.

Oh, and the page in the fine manual you want to read again for further 
details is <http://php.net/include/> ;-)


More information about the thelist mailing list