Page 1 of 1

Can't include using $_SERVER['DOCUMENT_ROOT']

Posted: Sun Oct 16, 2005 10:36 am
by shadow_005
Jcart | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]


I have a dir in the root dir called "Includes".
But for some reason i can't access it unless i hard code it (I have full admin rights). The last thing i want to do is hard coding something.

If i use this code in the main page it works:

Code: Select all

include("Includes/Config.inc");
If i use this code in the main page it doesnt work:

Code: Select all

include($_SERVER['DOCUMENT_ROOT']."/Includes/Config.inc");
It produces this error:
failed to open stream: No such file or directory
Why?


Jcart | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]

Posted: Sun Oct 16, 2005 10:42 am
by feyd
emit the variable, maybe you are working with it wrong.. or it may be set wrong or not at all..

Posted: Sun Oct 16, 2005 10:51 am
by shadow_005
Haha, i emitted it all the time. It was
c:/program files/easyphp1-8/www
But ofcourse i forgot that the actual project is in another directory... Problem solved thanks.
(I just noticed it when i hit the preview button in this post)


And sorry about the php tags. :oops: