ID: 9673
Updated by: stas
Old-Status: Open
Status: Analyzed
Bug Type: Scripting Engine problem
Assigned To: 

First, PHP include() is in no way related or was promised to
relate to C preprocessor directives, so no wonder it behaves

Now, all relative pathes are resolved against the current
directory of the including script (which is the directory
where it's located). This is a known issue. Use
include_pathes in the meantime.

Previous Comments:

[2001-03-10 16:45:48] [EMAIL PROTECTED]
Here is an example of how relative paths are currently resolved with cascading 
inclusions (command line is 'php /home/joe/a.php'):

File '/home/joe/a.php':
    # this include works as expected, 
    # locating '/home/joe/include/'
    include_once( 'include/' );

File '/home/joe/include/':
    # this include will assume '/home/joe/', but
    # not '/home/joe/include/', as one may expect =(
    include_once( '' );

File '/home/joe/include/':
    echo 'hello';

The way all four functions [require(), require_once(), include(), include_once()] 
resolve relative paths is counter-intuitive and unproductive with large directory 
structures, because some trickery is required to fix this problem. Not to mention that 
it hurts to see a different behavior from C-preprocessor #include directives.

If you don't believe me, then see comments to the include() function...


ATTENTION! Do NOT reply to this email!
To reply, use the web interface found at

PHP Development Mailing List <>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to