Kupo wrote:[color=blue]
> My problem is, when I do:
>
> include("../../library/file.php");
> // this is from e.g /level1/level2/something.php
>
> it works. However, when I use:
>
> include("../../../library/file.php");
> // and this one from /level1/level2/level3/something.php
>
> it doesn't work.[/color]
/How/ does it not work?
it includes a different file? :)
it gives a error message? ==> try error_reporting(E_ALL);
what is the error message?
it just ignores the include()?
[color=blue]
> So, does the include statement in php only cover 2
> upwards directories?[/color]
No.
[color=blue]
> Is there anyway around this?[/color]
Maybe if you specify the path from the root
include '/library/file.php';
no matter how deep you are in the directory structure.
[color=blue]
> Thanks.[/color]
It works for me:
$ cat /home/pedro/src/php/test.php
#!/usr/bin/php
<?php
error_reporting(E_ALL);
include 'inc.php';
include '../php/inc.php';
include '../../src/php/inc.php';
include '../../../pedro/src/php/inc.php';
include '../../../../home/pedro/src/php/inc.php';
include '../../../../../../../../../home/pedro/src/php/inc.php';
echo "Done!\n";
?>
$ cat /home/pedro/src/php/inc.php
<?php
echo "inside included file\n";
?>
$ cd /home/pedro/src/php
$ ./test.php
inside included file
inside included file
inside included file
inside included file
inside included file
inside included file
Done!
--
USENET would be a better place if everybody read: : mail address :
http://www.catb.org/~esr/faqs/smart-questions.html : is valid for :
http://www.netmeister.org/news/learn2quote2.html : "text/plain" :
http://www.expita.com/nomime.html : to 10K bytes :