Beginner issue: I can't get any controllers to work. |
[eluser]oddvalue[/eluser]
Hi. I literally just started using CodeIgniter today so I'm really new to this. I've been reading through all the documentation that comes with it and I've been trying to get the basic 'Hello World!' example to work but it just doesn't want to. I can get the welcome page up no problem but the moment I start adding controllers after 'index.php' it just comes back with 'Error 324 (net::ERR_EMPTY_RESPONSE): Unknown error.' Could I have missed something? Or is it possible some settings on my server are clashing? Thanks for any suggestions.
[eluser]InsiteFX[/eluser]
You need to change the default controller in apllication/config/routes.php Enjoy InsiteFX
[eluser]oddvalue[/eluser]
Thanks for the quick reply but that didn't help. If I change the default controller to anything other than 'welcome' it stops working.
[eluser]jedd[/eluser]
[quote author="oddvalue" date="1255741583"] I can get the welcome page up no problem but the moment I start adding controllers after 'index.php' it just comes back with 'Error 324 (net::ERR_EMPTY_RESPONSE): Unknown error.' [/quote] index.php isn't a controller. When you say 'adding controllers after index.php' - where are you putting these new controllers? What are they called (directory and filename) and what are the contents (show us) and what are the URL's you're using to try to access them?
[eluser]oddvalue[/eluser]
I've just been trying to follows the instructions here http://ellislab.com/codeigniter/user-gui...llers.html I follow the instructions to the word and it doesn't work. Put a file called 'blog.php' in /application/controllers/ with the Blog class in it telling it to echo 'Hello World!' then direct my browser to http://[my_domain]/index.php/blog. What am I missing?
[eluser]jedd[/eluser]
[quote author="oddvalue" date="1255756501"] I follow the instructions to the word and it doesn't work. Put a file called 'blog.php' in /application/controllers/ with the Blog class in it telling it to echo 'Hello World!' then direct my browser to http://[my_domain]/index.php/blog. [/quote] Sometimes people make a mistake with case, sometimes naming, sometimes something else that's not obvious to someone who's just starting out - that's why it's a good idea to cut-n-paste what you've put in the file. Use the [ code] tags when you post it, but there's plenty of space in a message to show us everything that you're doing. What OS are you on? You say the filename is called blog.php - which is good, and should be fine on the three common platforms. Are you using Apache? Try tracking the apache error and access logs - ideally you can do this in real time - if you're on a real operating system you can do this with these commands: Code: # tail -f /var/log/apache2/access.log & You'll be looking for errors about files it can't find, or files it doesn't have permission to read. You can check your file permissions too, just to make sure - again, how you do this depends on your platform. Did you make any changes to the other config files - such as changing the index_page in config.php? In that same file, what did you set your base_url to?
[eluser]alboyd[/eluser]
Why don't you watch some video tutorials and follow along. I find this is very helpful when first starting out. I'm sure you will manage to find heaps online - but if you have any trouble I can point you in the right direction (my vids)
[eluser]oddvalue[/eluser]
Ok well I've done everything that this link tells me: http://ellislab.com/codeigniter/user-gui...llers.html My code in 'blog.php' is as follows: Code: <?php Sadly I can't access any of the error logs. I'm hosting through a third party on a LAMP server. I could try it out on a local Linux server but I put all my sites on the same host so I figured it would be best to try it all out there. Does it matter that it's on a subdomain? The only config changes I've made have been to change the base_url to my url. It all seems really simple and I can see what it's trying to do. I just can't seem to make it happen.
[eluser]Tom Schlick[/eluser]
please paste the contents of your config.php file as well as the url you are trying to access.
[eluser]oddvalue[/eluser]
The URL I'm trying to access is 'http://dev.oddvalue.co.uk/index.php/blog/' as per the example and this is my config file: Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
Welcome Guest, Not a member yet? Register Sign In |