Ptoblem with "/" or root directory.

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Ptoblem with "/" or root directory.

Postby syn1st3rx » 19. June 2011 10:10

I'm pretty sure this is a common question:

I've been using XAMPP for about a month now, switching over from AppServ. (Loving it BTW).

However i cant seem to get my paths to link to my root directory when i use a forward slash before the path name "/file.php" (example) on my localhost. It works fine when i upload to my online server but i dont wanna have to keep uploading to debug.

PLEASE HELP!
syn1st3rx
 
Posts: 2
Joined: 19. June 2011 10:00

Re: Ptoblem with "/" or root directory.

Postby Nobbie » 19. June 2011 10:41

Nobbie
 
Posts: 8761
Joined: 09. March 2008 13:04

Re: Ptoblem with "/" or root directory.

Postby syn1st3rx » 19. June 2011 12:16

Thanks loads for the info.

I've however decided to use absolute paths for this. ie. http://localhost/directory/ and before uploading i'll simply do a find n replace with my actual domain name. ie http://www.domain.com/
syn1st3rx
 
Posts: 2
Joined: 19. June 2011 10:00

Re: Ptoblem with "/" or root directory.

Postby WilliL » 19. June 2011 14:05

do you mean sth like this?
Code: Select all
<?php
// script heading
If (($_SERVER["DOCUMENT_ROOT"] == "C:/xampp/htdocs") ? $rootpath = "C:/xampp/htdocs" : $rootpath = "/HOST_ROOT");
$inc_path = $rootpath."/inc";
require_once ($inc_path."/common_settings.php" ); //setting main parameter used in scripts, depending on xampp or hosted
// other script
?>

hint: internal links are differnt too
Willi
WilliL
 
Posts: 661
Joined: 08. January 2010 10:54
Operating System: Win7Home Prem 64 SP1


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 24 guests