Forum Moderators: coopster

Message Too Old, No Replies

URL issue

defining from root

         

fashezee

4:18 pm on Aug 8, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



When refering to a file using PHP; can you not define it via root:
such as:

<?php include('/htdocs/header/header01.html');?>

I also tried:

<?php include('/header/header01.html');?>

Are we restricted in refering to files relatively?

bcolflesh

4:25 pm on Aug 8, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Try:

<?php include('$_SERVER["DOCUMENT_ROOT"]/htdocs/header/header01.html');?>

fashezee

4:41 pm on Aug 8, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks Tips! but no cigar. Could it be a server issue?

jatar_k

4:49 pm on Aug 8, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



you can do both, bcolflesh is right but he probably had the wrong path

$_SERVER["DOCUMENT_ROOT"]

would be the same server path as if you referenced / on a web page. It is the root of the domain.

you can use include with the absolute path from the root of the webserver

try echo'ing $_SERVER["DOCUMENT_ROOT"]
and see what it gives you.

panic

5:43 pm on Aug 8, 2003 (gmt 0)

10+ Year Member



Fasheezee,

Try :

chmod 777 /htdocs/header/

That'll let you know if it's a permission issue.

If that doesn't work, then try calling header01.html relative to where root is. I'm not sure how you have your directories structured in Linux, but if you have your PHP file that you want to include header01.html in /home/www/, and header01.html is in /htdocs/header/, try this :

include("../../htdocs/header/header01.html");

-panic