include() problem with reinstallation of PHP4.3.8 /Apache1.3

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
sneakypants
Forum Newbie
Posts: 2
Joined: Sat Jul 17, 2004 1:17 am
Location: San Francisco

include() problem with reinstallation of PHP4.3.8 /Apache1.3

Post by sneakypants »

This is a weird problem and has been bugging me for the past few hours so I thought I'd try and get some help.

So, basically I set up Apache/PHP on another Win2000pro machine and moved all my old files from my other computer's htdocs folder, over to the new server, which I tried to set up the same way.

Many of my php files use this function:
include ($DOCUMENT_ROOT."/meta/main.php");

everything loads up fine and is included in my old setup as well as on the remote server I am using.

But when I try and load a page with the new setup, I get these errors:

Warning: main(/meta/main.php): failed to open stream: No such file or directory in c:\program files\apache group\apache\htdocs\joeyandt\home.php on line 22

Warning: main(): Failed opening '/meta/main.php' for inclusion (include_path='.;c:\php4\pear') in c:\program files\apache group\apache\htdocs\joeyandt\home.php on line 22

It works if I just remove the forward slash before meta within the include function, like this:
include ($DOCUMENT_ROOT."meta/main.php");

When I upload it to my remote server, obviously this doesn't work, so I am kind of screwed here.

I was using PHP 4.2.3 now I upgraded to 4.3.8 (but i don't think this is what is causing the problem)

I'm not really sure at all what is causing this, so if anyone understands my post, please let me know what is going on! Thanks

(oh yea, also, if this helps, i made a file with just
print $DOCUMENT_ROOT;
and when I load that on the new server setup it just brings up a blank page. But on the remote it works just fine. what gives?)
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

try $_SERVER['DOCUMENT_ROOT']

It sounds like you had register_globals on in your last install. (Which was still defaulting to on around that time). However, since 4.3.0 or something, register_globals was defaulting to off, for security reasons..
sneakypants
Forum Newbie
Posts: 2
Joined: Sat Jul 17, 2004 1:17 am
Location: San Francisco

Post by sneakypants »

yep, that's what it was. I read about that, somewhere in my various searches for help, but was trying it without the first underscore by accident. Thanks a lot for your insight!
Post Reply