include("../xx/xx.php"); does not work! y?

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
Neon
Forum Newbie
Posts: 4
Joined: Mon Jul 22, 2002 1:18 pm

include("../xx/xx.php"); does not work! y?

Post by Neon »

I guess there is something wrong mit my php or Apache configuration...
include("./xx/xx.php"); woks but not at all. If i use include("../xx/xx.php"); i does not work! I dont know what is wrong plz help me! I want ../ to be a link to my root directory as it works with all other providers i know.


Neon
gnu2php
Forum Contributor
Posts: 122
Joined: Thu Jul 11, 2002 2:53 am

Post by gnu2php »

Does it work if you use the "absolute" path? Such as "/path/xx/xx.php"

By the way, what's the include_path directive set to? Use phpinfo() to find out.

Also, what's the error message you get? Use require() if there isn't one.
Neon
Forum Newbie
Posts: 4
Joined: Mon Jul 22, 2002 1:18 pm

Post by Neon »

the include_path is set to the doc_root which is d:\hp4

the message is: Fatal error: Failed opening required '../media/foot.php' (include_path='d:\hp4') in d:\hp4\index.php on line 3
gnu2php
Forum Contributor
Posts: 122
Joined: Thu Jul 11, 2002 2:53 am

Post by gnu2php »

Does require("d:\\media\\foot.php") or require("d:/media/foot.php") work? If not, the only way to include it might be to place the foot.php file in the hp4 path--or maybe place the entire media folder in hp4.
Neon
Forum Newbie
Posts: 4
Joined: Mon Jul 22, 2002 1:18 pm

Post by Neon »

the foot.php is in d:\hp4\media\foot.php !
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Then does

Code: Select all

require 'media/foot.php';
work?

Mac
Neon
Forum Newbie
Posts: 4
Joined: Mon Jul 22, 2002 1:18 pm

Post by Neon »

Yes it works but i need require("../media/foot.php");
I can use
/media/foot.php
./media/foot.php too...
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

the foot.php is in d:\hp4\media\foot.php
Then why do you need

Code: Select all

require '../media/foot.php';
to access it from a file in hp4? Basically when you do that you're looking for the file d:\media\foot.php, which, as the error message tells you, doesn't exist.

Mac
gnu2php
Forum Contributor
Posts: 122
Joined: Thu Jul 11, 2002 2:53 am

Post by gnu2php »

If, for some reason, you have to use the dots, you might try this:

Code: Select all

require("../hp4/media/foot.php");
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

:lol: Good point.

Mac
Post Reply