Welcome Guest, Not a member yet? Register   Sign In
New site file not found issues
#1

[eluser]Dahak-II[/eluser]
After having had CodeIgniter thrust upon me at the office, I've grown to like it. I am doing a long-overdue rewrite of my personal site using the new framework as a familiarization exercise.

The obvious must be escaping me.

This will turn out to be a noob issue, but other than getting the default index controller functioning, I can't get any other controllers to function. I get the dreaded Page Cannot Be Found result.

I'm using the newest release, v1.7.0 and my initial set up is pretty plain vanilla. The routes.php file only has one change:

Code:
$route['default_controller'] = "home";

I autoload:

Code:
$autoload['helper'] = array('cookie', 'url', 'html', 'file');

The only significant change to the config.php file is:

Code:
if (stristr(PHP_OS, 'WIN')) {
  $config['base_url']    = "http://127.0.0.1/";
} else {
  $config['base_url']    = "http://dev.thefifthimperium.com/";
}

...since I'm developing it locally on a Windows XP box running IIS and deploying it to a Linux-based Apache machine.

Requesting http://127.0.0.1/ or http://127.0.0.1/index.php works fine, but http://127.0.0.1/index.php/home/index/ or http://127.0.0.1/index.php/home/book/title/ do not, as I expect they should. No other controllers can be called, either.

The controller set up is pretty plain:

Code:
class Home extends Controller {

function Home()
{
    parent::Controller();
}
    
function index() {
    
/* Load models */
  $this->output->enable_profiler(TRUE);
  $this->load->model('Home_model', 'home');

  /* Get required data */
  $data['lightweight'] = $this->home->getWeightiness();
  $data['scrollmethod'] = $this->home->getScrollerMethod();
  $data['random_color'] = $this->home->getRandomColor();

  $data['navBarSource'] = $this->home->buildNavBarSrc( $data );

  $data['maxchaptersearch'] = $this->config->item('maxchaptersearch');
  $data['maxchaptersearchincrement'] = $this->config->item('maxchaptersearchincrement');
  $data['maxpiecesperchaptersearch'] = $this->config->item('maxpiecesperchaptersearch');
  $data['siteroot'] = $this->config->item('siteroot');
  $data['bookroot'] = $this->config->item('bookroot');

  /* Load Views */
  $this->load->view( 'header', $data );
  $this->load->view( 'navbar', $data );
  $this->load->view( 'mainbody', $data );
  $this->load->view( 'footer' );
  flush();
}

function book( $collection ) {

//      echo "[$collection]<br>\n";
  if(is_null($collection)){
    show_404();
  } else {
    /* Load models */
    $this->output->enable_profiler(TRUE);
    $this->load->model('Home_model', 'home');

    /* Get required data */
    $data['lightweight'] = $this->home->getWeightiness();
    $data['scrollmethod'] = $this->home->getScrollerMethod();
    $data['random_color'] = $this->home->getRandomColor();

    $data['navBarSource'] = $this->home->buildNavBarSrc( $data );

    $data['maxchaptersearch'] = $this->config->item('maxchaptersearch');
    $data['maxchaptersearchincrement'] = $this->config->item('maxchaptersearchincrement');
    $data['maxpiecesperchaptersearch'] = $this->config->item('maxpiecesperchaptersearch');
    $data['siteroot'] = $this->config->item('siteroot');
    $data['bookroot'] = $this->config->item('bookroot');

    /* Load Views */
    $this->load->view( 'header', $data );
    $this->load->view( 'navbar', $data );
    $this->load->view( 'mainbody', $data );
    $this->load->view( 'footer' );
    flush();
  }
}

}

Any idea on what simple, blindingly obvious configuration issue I might be missing?

The site behaves the same on the local Windows XP/IIS and remote Linux/Apache servers.

Thanks.
#2

[eluser]Randy Casburn[/eluser]
Hi,

You'll likely need to adjust the :

$config['uri_protocol'] = "AUTO"; // maybe PATH_INFO ?

Setting in config.php as well.

Watch for this when deploying to your linux box. I might recommend putting your same switch over this setting as well once you figure out what works.

Randy
#3

[eluser]Dahak-II[/eluser]
[quote author="Randy Casburn" date="1225057674"]Hi,

You'll likely need to adjust the :

$config['uri_protocol'] = "AUTO"; // maybe PATH_INFO ?

Setting in config.php as well.

Watch for this when deploying to your linux box. I might recommend putting your same switch over this setting as well once you figure out what works.

Randy[/quote]

Thanks, but so far, the local Win XP/IIS server doesn't seem to like any of the available options any better.
#4

[eluser]Randy Casburn[/eluser]
What shows up in your $_SERVER array when you dump it with your request for index.php/home/index/ ?

Looking specifically for ['ORIG_PATH_INFO'] or ['PATH_INFO'] to contain these. If they do, you should be able to use those (or where ever it shows up in your $_SERVER array.

Randty
#5

[eluser]Dahak-II[/eluser]
[quote author="Randy Casburn" date="1225062717"]What shows up in your $_SERVER array when you dump it with your request for index.php/home/index/ ?

Looking specifically for ['ORIG_PATH_INFO'] or ['PATH_INFO'] to contain these. If they do, you should be able to use those (or where ever it shows up in your $_SERVER array.

Randty[/quote]

I can't get the $_SERVER array when I attempt to directly call a controller, I get page not found.

For the default index, the local box reports ORIG_PATH_INFO = /index.php and URL = /index.php which, when configured, give me CI 404 pages.

I've been trying other globals, with no success yet. Should I be looking for a scrip name or a full URL (ie '/index.php' or 'http://dev.thefifthimperium.com/index.php')?

Thanks.
#6

[eluser]Randy Casburn[/eluser]
yea...replace your index.php file with a temporary replacement to do this test. just to capture the url and report the $_SERVER array. We just need to see how IIS is putting things together for you. Then we'll put things back together.

Randy
#7

[eluser]Dahak-II[/eluser]
[quote author="Randy Casburn" date="1225065157"]yea...replace your index.php file with a temporary replacement to do this test. just to capture the url and report the $_SERVER array. We just need to see how IIS is putting things together for you. Then we'll put things back together.

Randy[/quote]

Here are the relavant globals for the local IIS server when requsting the script http://127.0.0.1/this/is/a/test/path/script.php

Code:
SCRIPT_NAME = [ /this/is/a/test/path/script.php ]
PATH_TRANSLATED = [ c:\inetpub\wwwroot ]
REMOTE_ADDR = [ 127.0.0.1 ]
REMOTE_HOST = [ 127.0.0.1 ]
SERVER_NAME = [ 127.0.0.1 ]
APPL_MD_PATH = [ /LM/W3SVC/1/ROOT ]
APPL_PHYSICAL_PATH = [ c:\inetpub\wwwroot\ ]
INSTANCE_META_PATH = [ /LM/W3SVC/1 ]
REQUEST_URI = [ /this/is/a/test/path/script.php ]
URL = [ /this/is/a/test/path/script.php ]
SCRIPT_FILENAME = [ c:\inetpub\wwwroot\this\is\a\test\path\script.php ]
ORIG_PATH_INFO = [ /this/is/a/test/path/script.php ]
PATH_INFO = [ ]
ORIG_PATH_TRANSLATED = [ c:\inetpub\wwwroot\this\is\a\test\path\script.php ]
DOCUMENT_ROOT = [ c:\inetpub\wwwroot ]
PHP_SELF = [ /this/is/a/test/path/script.php ]

I've already tested most of these without success.

And, to make life more interesting, not all of the same globals are provided by the Linux/Apache server.

Thanks for your help.
#8

[eluser]Randy Casburn[/eluser]
OK, we can see the correct path is stored in both 'ORIG_PATH_INFO' and 'REQUEST_URI' on your IIS server.

So let's stick with one of those for now.

We'll need to establish why CI will not recognize these.

I'm a little busy at the moment, but that is where we need to turn next.

Randy
#9

[eluser]Dahak-II[/eluser]
[quote author="Randy Casburn" date="1225082517"]OK, we can see the correct path is stored in both 'ORIG_PATH_INFO' and 'REQUEST_URI' on your IIS server.

So let's stick with one of those for now.

We'll need to establish why CI will not recognize these.

I'm a little busy at the moment, but that is where we need to turn next.

Randy[/quote]

No problem. Thanks for the time you've already spent.

I've turned on full logging and the local box seems to be generating two unexpected permission denied file-access warnings.

The Linux box doesn't report any logged warnings.

I added some debug logging to the URI library.

When loading the /index.php file, it resolves the URI to the default empty string. Nothing gets logged when the browser fails to load my book() controller.

-Joe
#10

[eluser]Randy Casburn[/eluser]
Put an this statement at line 112 of libraries/URI.php:

echo $_SERVER['ORIG_PATH_INFO'];

The very next line (line 113 should be:

$this->uri_string = (isset($_SERVER[$uri])) ? $_SERVER[$uri] : @getenv($uri);

---

Let's see what get's echo'd

Randy




Theme © iAndrew 2016 - Forum software by © MyBB