If I were to write an include with a relative path like
include("../conf/config.php");
What is the use?
As far as I understand it, the path is relative to the first script that
is called by php.
In other words, if the current working directory is /www/ and you were
"executing" a.php in that directory, then a.php included
/www/include/b.php by doing include("includ e/b.php");, then b.php tried
to include file /www/config/c.php, by doing include("../config/c.php) it
would not work. Instead php would be looking in /config for c.php and
it would not find it (?!).
Relative paths in include directives seem useless, because the paths are
not relative to the file that the include directive is in, like you
would expect them to be. These includes are totally dependant on where
the original file was "run" from.
Can any one shed some light on why relative paths in includes are of
-any- practical use in PHP? Or, is this a bug?
PHP 4.3.4 (cli) (built: Mar 9 2004 11:40:14)
By the way, I am just trying to separate my php project files into a few
directories. I just want to be able to include them without using
absolute paths. These files in these different directories should be
able to include each other.
-d
Comment