PDA

View Full Version : Include path, $DOCUMENT_ROOT


gmarik
04-16-2003, 07:04 PM
A non vb related php question. I have a hoster, and he has different php.ini file configuration, so there are several problems with that. The biggest of them is:

Include paths. Those, who work on the root level, don't work in the folders, that is - on the second level.
config.inc.php:
$root = "http://www.complex-systems.ru";
include ("$root/elem/func.inc.php");
include ("$root/elem/lang.inc.php");


It works here: http://www.complex-systems.ru/, but does not works any more here: http://www.complex-systems.ru/requisites/

I thought $_SERVER["DOCUMENT_ROOT"] could be a good idea, but is seems the promlem has not been solved yet. Do you have an idea or a sollusion. I'm making a CMS tool.

Kriek
04-18-2003, 10:24 PM
Method no.1 (SERVER_NAME)

$root = $_SERVER['SERVER_NAME'];
include('http://' . $root . '/elem/func.inc.php');
include('http://' . $root . '/elem/lang.inc.php');

Method no.2 (DOCUMENT_ROOT)

$root = $_SERVER['DOCUMENT_ROOT'];
include($root . '/elem/func.inc.php');
include($root . '/elem/lang.inc.php');