Welcome Guest, Not a member yet? Register   Sign In
Newbie having problems calling controller
#1

[eluser]Jeffrey Lasut[/eluser]
First of all I've been searching this form inside out, but couldn't find a working solution for me.

I'm using a clean installation of CI 1.6.2, I got this one placed in my apache root and can see the welcomepage.

I create a file called home.php

Code:
<?php

class Home extends Controller   {
        function Home(){
             parent::Controller();
        }

        function index(){    
             echo "test";
        }
}

When requesting for http://localhost/CodeIgniter/index.php/home I'm getting a page not found, this is the same for the default http://localhost/CodeIgniter/index.php/welcome

If i'm setting
$route['default_controller'] = "welcome";
to
$route['default_controller'] = "home";
I can see test.

Things I tried:
- $config['index_page'] = "index.php?";
- using .htaccess
Code:
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /CodeIgniter/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
    # If we don't have mod_rewrite installed, all 404's
    # can be sent to index.php, and everything works as normal.
    # Submitted by: ElliotHaughin

    ErrorDocument 404 /index.php
</IfModule>


My current config:
$config['base_url'] = "http://127.0.0.1/CodeIgniter/";
$config['index_page'] = "index.php?";
$config['uri_protocol'] = "QUERY_STRING"; (AUTO seems not to be working)

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

These are my system details:
Windows XP
Apache/2.0.59 (Win32) Server at 127.0.0.1 Port 80
PHP Version 4.4.7
CodeIgniter 1.6.2

I hope someone can help me!

Thanx
#2

[eluser]Michael Wales[/eluser]
So, in Apache web root you have a folder CodeIgniter, which houses your index.php? (./htdocs/CodeIgniter/index.php). Just want to make sure we start off on the same foot here.

If you change the default controller it works - so we know it's not filesystem.

Try this:
Ditch the .htacess file for now.
Change index_page to index.php
Change uri_protocol to each of the diff. settings and try to load the page. REQUEST_URI has a good track record for working on oddly configured hosts.
#3

[eluser]Jeffrey Lasut[/eluser]
[quote author="Michael Wales" date="1211651284"]So, in Apache web root you have a folder CodeIgniter, which houses your index.php? (./htdocs/CodeIgniter/index.php). Just want to make sure we start off on the same foot here.

If you change the default controller it works - so we know it's not filesystem.

Try this:
Ditch the .htacess file for now.
Change index_page to index.php
Change uri_protocol to each of the diff. settings and try to load the page. REQUEST_URI has a good track record for working on oddly configured hosts.[/quote]

Michael thanx for your reply.

Thats correct, a folder which houses the index.php called CodeIgniter (It is a clean CI installation) is standing in the Apache web root.

I've tried your setting with no result, if I'm using QUERY_STRING this is working with this url: http://localhost/CodeIgniter/index.php?home

Could this be a because a corrupt Apache / PHP setting?

Thanx
#4

[eluser]JWarren[/eluser]
I was having the same problem starting with version 1.6. It only occurs, however, when CI is in a sub-folder and I believe only on Windows. Someone on this board suggested changing $config['uri_protocol'] from "AUTO" to "PATH_INFO" and that fixed it for me.
#5

[eluser]Jeffrey Lasut[/eluser]
[quote author="JWarren" date="1212263561"]I was having the same problem starting with version 1.6. It only occurs, however, when CI is in a sub-folder and I believe only on Windows. Someone on this board suggested changing $config['uri_protocol'] from "AUTO" to "PATH_INFO" and that fixed it for me.[/quote]

Thanx for your reply!

I will try this later one today.

Strange enough this url is working:
http://localhost/CodeIgniter/index.php?home/index

This way I can call any function index or other.
#6

[eluser]Jeffrey Lasut[/eluser]
[quote author="JWarren" date="1212263561"]I was having the same problem starting with version 1.6. It only occurs, however, when CI is in a sub-folder and I believe only on Windows. Someone on this board suggested changing $config['uri_protocol'] from "AUTO" to "PATH_INFO" and that fixed it for me.[/quote]

Changing to PATH_INFO dosn't work, only the QUERY_STRING option seems to be working.




Theme © iAndrew 2016 - Forum software by © MyBB