Page 1 of 1

Using/Giving absolute path

Posted: Mon Jan 11, 2010 3:40 am
by itsmani1
Hi

I wanted to use absolute path in includes ... If if use

http://www.site.com/inc/myfile.php it gives me error.

What's the best way to use it?

Re: Using/Giving absolute path

Posted: Mon Jan 11, 2010 3:59 am
by requinix
Use the absolute path to the file as it is on the file system. In general,

Code: Select all

require $_SERVER["DOCUMENT_ROOT"] . "/inc/myfile.php";

Re: Using/Giving absolute path

Posted: Mon Jan 11, 2010 4:00 am
by papa
Maybe this can help: http://php.net/manual/en/reserved.variables.server.php

Edit: tasairis was faster.. :)