How to include a file from another folder?

There is a file located at papka1/papka1/file1.php.
This file has an include of another file, from another directory:
include(‘../papka2/papka2/file2.php’);
But for some reason, the site, when executing file1, gives an error:

Warning:
include(‘../papka2/papka2/file2.php’)
[function.include]: failed to open
stream: No such file or directory in
papka1/papka1/file1.php

Warning: include() [function.include]:
Failed opening
‘../papka2/papka2/file2.php’ for
inclusion
(include_path=’.:/usr/local/php52/lib/php’)
in papka1/papka1/file1.php

How to fix this and make it a normal include?


Answer 1

Deal with relative paths, you need to go up 2 levels:

../../papka2/papka2/file2.php

Leave a reply

Please enter your comment!
Please enter your name here