can not require or include a file

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
foolish
Forum Newbie
Posts: 2
Joined: Wed Apr 14, 2004 12:19 pm
Contact:

can not require or include a file

Post by foolish »

My dir structure is:
rootdir
|___dir1
| |__file1.php
| |__file2.php
| |__file3.php
|
|___dir2
|__file4.php

So I wrote some code

In file3.php
<?
require("file1.php");
require("file2.php");
?>


When I placed file4.php in the rootdir and write it as following
<?
require("dir1/file3.php");
?>
The script run completely


But when I move file4.php into dir2 and write some code in it as following
<?
require("../dir1/file3.php");
?>

I recieved a warning:
Can not open "../dir1/file1.php" for require..... in file file3.php at line...

Please help me to solve this problem.
Thanks very much!
Post Reply