|  | Posted by duzhidian@gmail.com on 10/15/07 21:16 
If I move the programs to other places, using absolute paths willsuffer, need to change every file.
 
 
 
 On Oct 15, 4:56 pm, Jerry Stuckle <jstuck...@attglobal.net> wrote:
 > duzhid...@gmail.com wrote:
 > > failed to open stream: No such file or directory
 >
 > > I have the programs like this structure:
 >
 > > a.php is locate at .
 > > b.php is located at ./lib
 > > c.php is located at ./lib/sublib
 >
 > > a.php uses a function at b.php while b.php using a function at c.php
 >
 > > In a.php, it says: include_once(./lib/b.php) as it uses one function
 > > in b.php
 > > a.php is not supposed to know that b.php is using c.php, so it should
 > > not include c.php.
 >
 > > In b.php, it says: include_once(./sublib/c.php) since it uses a
 > > function in c.php.
 > > b.php is not supposed to know that a.php uses itself, so it should not
 > > include lib as include_once(../lib/sublib/c.php), but it does not
 > > work.
 >
 > > The problem is: "... failed to open stream: No such file or directory
 > > of c.php. .."
 >
 > > If using include_once(../lib/sublib/c.php) in b.php, the compiler is
 > > happy.  But it violates the general principle of who include files
 > > only considering itself at it own position, not considering others who
 > > use it (also, it is not supposed to know it) as in C++.
 >
 > > Any hints how to obey the above principle?
 >
 > > Thanks.
 >
 > > D.
 >
 > Don't use relative paths.  Use absolute paths.  If you're running this
 > under a webserver, you can get to the web server's root with
 > $_SERVER['DOCUMENT_ROOT'] and go from there.
 >
 > --
 > ==================
 > Remove the "x" from my email address
 > Jerry Stuckle
 > JDS Computer Training Corp.
 > jstuck...@attglobal.net
 > ==================
  Navigation: [Reply to this message] |