Page 1 of 1
path porblems
Posted: Tue Jun 20, 2006 8:50 am
by DUZ
haya,
i have a little problem i cant seem to find a way to fix
its pretty simple (i have php 5.1.4 on apache 2.2.2)
apache conf file DocumentRoot "D:/www/"
i used include("/con.php"); in smth.php which is in D:/www/smth/
and the server return error that it cant find the file
the server is looking for con.php in D:/ not in D:/www/
and / should bring you in the DocumentRoot not in D:/
how can i fix this ?
Posted: Tue Jun 20, 2006 9:14 am
by feyd
include uses file system level lookups, it doesn't care where your document root is.. so no, / is not supposed to be your document root. You may want to look at $_SERVER['DOCUMENT_ROOT'].
Posted: Tue Jun 20, 2006 9:40 am
by DUZ
i guess im wrong =/
my friend said that his server / brings him to the docroot
maybe he got something wrong and i got confused
i found out that ./ brings u to the docroot
10x anyway
Posted: Tue Jun 20, 2006 9:41 am
by feyd
./ isn't the document root either. It's the current directory, wherever that may be.
Posted: Tue Jun 20, 2006 9:49 am
by timvw
he location of . for include/require is determined by the include_path setting...
Changing the include_path (programatically) i usually do as following:
Code: Select all
<?php
ini_set(‘error_reporting’, E_ALL);
ini_set(‘display_errors’, TRUE);
$include_paths = array(
‘.’,
‘/home/users/timvw/phpincs’,
‘/home/users/timvw/pear’,
ini_get(‘include_path’)
);
ini_set(‘include_path’, implode(PATH_SEPARATOR, $include_paths));
?>
Posted: Tue Jun 20, 2006 9:54 am
by DUZ
so i guess the only way is $document_root or with ../
Posted: Tue Jun 20, 2006 9:56 am
by feyd
../ is the parent directory, which is relative to the current directory wherever it may be. As I said before, use $_SERVER['DOCUMENT_ROOT'].