Page 1 of 1

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

Posted: Sat Jul 17, 2004 1:17 am
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?)

Posted: Sat Jul 17, 2004 1:21 am
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..

Posted: Sat Jul 17, 2004 5:29 am
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!