$_SERVER['PATH_INFO'] issue, traq not working

42
Defect
fabianCastle
-
0.6
-
Core
Invalid
Highest
Blocker
8 years ago
3 years ago
0

Description

After testing the application this afternoon (an liking it), I decided to upload it to my web server. Unfortunally, it stopped working.

Seems like the $_SERVER['PATH_INFO'] (in the uri class) is not returning anything, therefore anything further the projectlisting is not accessible any more.

Please review and let me know, thanks.

Ticket History

8 years and 6 months ago by fabianCastle

  • Changed Priority from Normal to Highest

8 years and 6 months ago by fabianCastle

  • Changed Component from Tickets to Core
  • Changed Status from New to Reopened

I have fixed it in my hosting-server, by I had to modify the URI calls as indicated bellow:

<?php /** * Origin * Copyright (c) 2009 Rainbird Studios * $Id: uri.php 21 2009-02-22 06:59:44Z jack $ */

/** * URI Class * @version $Rev: 21 $ */ class URI { public $seg = array();

public function __construct() {
    /* Modified by Fabian */
        $installationDir="traq/";
        $pathinfo = trim($_SERVER['REQUEST_URI'],'/');
        $pathinfo = trim(str_replace($installationDir,"",$pathinfo));
        if($installationDir==$pathinfo."/") $pathinfo="";
    /////////////////////////////////////////////////////////////////

    $segments = explode('/',$pathinfo);
    $this->seg = $segments;
}

public function geturi() {
    return $this->anchor().implode('/',$this->seg).'/';
}

public function anchor($segments = array()) {

    if(!is_array($segments)) {
        $segments = func_get_args();
    }
    /* Modified by Fabian */
        $installationDir= "http://". $_SERVER["HTTP_HOST"]. "/traq/";
        $path = str_replace('index.php','',$_SERVER['SCRIPT_NAME']);
        return  $installationDir . $this->array_to_uri($segments);
    ////////////////////////////////////////////////////////////////////
}

private function array_to_uri($segments = array()) {
    if(count($segments) < 1
    or !is_array($segments)) {
        return;
    }
    foreach($segments as $key => $val) {
        $segs[] = $val;
    }
    return implode('/',$segs).'/';
}

} ?>

Would you please analyze these changes, it might not be the best way to solve it,but it worked for me. Hope that this helps you.

8 years and 6 months ago by Jack

What web server are you running? Apache/Lighttpd/nginx/IIS ?

8 years and 6 months ago by Jack

  • Changed Status from Reopened to New

8 years and 6 months ago by fabianCastle

Linux, Centos, Apache Another fact is that I had already a main application running in public folder and in order to install traq 0.5 I had to create another folder for it's dedicated use. In other workds, traq 0.5 was not installed directly on the virtualhost directory, but in a sub-folder.

8 years and 6 months ago by Jack

  • Closed ticket as Invalid

Traq is designed to be accessed directly, not through a sub folder.