...

View Full Version : Resolved problem with include path (xampp on Xp)



fail
11-25-2010, 05:32 AM
I have a problem with include() path!

I run XAMPP on Xp and tried already many combination, if one works, they other does not.

Absolute path are:

c://xampp/htdocs/todo/connect.php");
c://xampp/htdocs/bom3/css/cssmenu.php");

From other server would be: http://192.168.0.103/todo/.... etc.




I tried:
include("connect.php"); // ok
include("/bom3/css/cssmenu.php"); // error


include("connect.php"); // ok
include("./bom3/css/cssmenu.php"); // error


include("connect.php"); // tries to connect to other db in bom3/
include("../bom3/css/cssmenu.php"); // ok




How can I do that?

jim_keller
11-25-2010, 05:36 AM
The top level directory available to include() isn't the docroot of the webserver, meaning that passing /bom3 to include() will tell it to try to look on the filesystem for a directory called /bom3, which will never exist on windows. You will need to pass it the full path:


$bom3_dir = 'C:\\xampp\\htdocs\\bom3\\css';
include( $bom3_dir . DIRECTORY_SEPARATOR . 'cssmenu.php' );

fail
11-25-2010, 05:43 AM
Thank you!

I don't really understand it, but this way it works:



$bom3_dir = 'C:\\xampp\\htdocs\\bom3\\css';
include( $bom3_dir . DIRECTORY_SEPARATOR . 'cssmenu.php' );

include("connect.php");



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum