Welcome Guest, Not a member yet? Register   Sign In
Help setting up CodeIgniter
#1

[eluser]noob[/eluser]
Hello,
I am trying to setup codeigniter on my computer by following the user guide. But I must be doing something wrong. I am getting the 404 error with the hello world example.
I unzipped codeigniter and put the CodeIgniter_1.6.1 folder in my webroot folder.
I renamed the folder CodeIgniter.
Went into CodeIgniter/system/application/config/cofig.php and made sure that the following line is set: $config['base_url'] = "http://127.0.0.1/CodeIgniter/"
Then I placed the following code in CodeIgniter/system/application/controllers and named it blog.php

Code:
<?php
class Blog extends Controller {

    function index()
    {
        echo 'Hello world!';
    }
}
?>

And afterwards when I go to http://127.0.0.1/CodeIgniter/index.php/blog through my browser, I get a 404 error. What am I doing wrong? Kindly help. Many thanks in advance.
#2

[eluser]Pascal Kriete[/eluser]
I've read it ten times now, and it looks correct. If you simply go to http://127.0.0.1/CodeIgniter/, does it load the welcome screen?
#3

[eluser]Tom Glover[/eluser]
[quote author="inparo" date="1205895061"]I've read it ten times now, and it looks correct. If you simply go to http://127.0.0.1/CodeIgniter/, does it load the welcome screen?[/quote]

I looked at it earlier an could not see anything wrong.
#4

[eluser]Glen Swinfield[/eluser]
Whate server/computer setup d you have - are you using mamp/wamp - a seperate apache install?
#5

[eluser]wiredesignz[/eluser]
Code:
<?php
class Blog extends Controller {

    function Blog()
    {
        parent::Controller();    //did anyone notice the missing constructor?
    }

    function index()
    {
        echo 'Hello world!';
    }
}
?>
#6

[eluser]Pascal Kriete[/eluser]
Sure did, but it's not needed for the above code. You won't have access to the ci super object, but echoing should work fine.
#7

[eluser]wiredesignz[/eluser]
If all he wanted to do was echo "Hello World" then using CodeIgniter is overkill don't you think Tongue
#8

[eluser]noob[/eluser]
Thanks for all your replies. It seems that my linux installation is screwed up. PHP is not parsing files for some reason. I installed CodeIgniter on my windows partition and its working great.(oh the shame)
#9

[eluser]Zac G.[/eluser]
I am getting this as well, however when I try to redirect from one file to another, and am running this on a hosted site. Do you know what was wrong with the linux setup. I am thinking it might be the server, but I am not sure what it is.

<?=$problemSolved?>
Ok, I didn't have the base_url set in the config.php. All good now Wink




Theme © iAndrew 2016 - Forum software by © MyBB