Hey,
I've written a custom HTML library using many PHP scripts as seperate
files (just like I'd do a java project) and I'm having some problems
where I'm including scripts in different directories from already
included scripts... basically where there'a an include chain spanning
multiple directories.
I've reduced the problem to its core:
Imagine you have a website consisting of 4 PHP files:
/top_site.php
/inlcudes/top_lib.php
/includes/lib/lib1/lib1.php
/includes/lib/lib2/lib2.php
the contents of which are:
top_site.php = <? include_once("includes/top_lib.php"); ?>
top_lib.php = <? include_once("lib/lib1/lib1.php"); ?>
lib1.php = <? include_once("../lib2/lib2.php"); ?>
lib2.php = <? echo "Hello World!"; ?>
now when I go to http://YOUR_WEBSITE_ROOT/top_site.php I get an error
saying that the include within lib1.php can't find lib2.php...
....BUT if I go directly to
http://YOUR_WEBSITE_ROOT/includes/lib1/lib1.php then you'll see that
it includes lib2.php fine!!!
Try it for yourself; it won't take a minute to set up.
I've checked my include path and it looks fine (having '.' in it), so
I'm basically stuck there. Oh, and I'm running PHP version 4.2.2 on
Linux RH9/Apache 2.
Has anyone else seen this before? Have any ideas? Cos I don't really
want to have to convert everything over to absolute (not sure if
this'll work either) and I've written LOTS of code! D'OH!
Thanks,
Rob Long.