Problems accessing methods in a controller |
[eluser]Rey Philip Regis[/eluser]
Hi guys, I need you help, I have problems accessing methods in my controller. Here's a sample code: Code: <?php The problem now is that when I try to access the addition method in the browser it'll display an error "404 Page Not Found". I tried accessing like this http://localhost/codeigniter/test/addition By the way in the above example, i have a .htaccess file then changed the config.php so I can use clean URLs. Server Information: Operating System: Fedora Linux PHP version: 5.2.7 Apache: 2.2 (rewrite_module enabled) I think this is a configuration problem. Do you know how to solve this problems? Cause in my windows machine using Wamp Server I have no problems like this. Hope you can help me guys, thanks in advance.. Philip
[eluser]fensen[/eluser]
The code looks fine. Are you using a .htaccess file? If so, please check the redirect directive. You can also disable .htaccess and try: Quote:http://localhost/codeigniter/index.php/test/addition
[eluser]Rey Philip Regis[/eluser]
Yah the code is right, cause its running in windows already. But when I transferred the program to Linux (Fefora) there are errors. Yes, I have .htaccess file already and I changed the $config['index_page'] = ""; to blank already so I can use "clean url's". Yes the code will run using http://localhost/codeigniter/index.php/test/addition/ But that is not what I am aiming for, I want to do something like this "clean url's" http://localhost/codeigniter/test/addition which is running in my windows machine but in linux there are errors like The requested URL /codeigniter/test/addition/ was not found on this server. I don't know really why it happens, cause I have mod_rewrite enabled already and then I have the .htaccess file. I know this is a configuration problem in Linux machine. I'm not familiar with it, so if you guys can help me with it. Thanks in advance..
[eluser]Rey Philip Regis[/eluser]
hello to all, Well congrats to myself, I managed to run my program I mean my real project and the test program. To all the developers who has the same problem that I had the solution is the configuration in the apache's httd.conf. I said earlier in my previous posts that the mod_rewrite in apache is enabled. I thought it was enabled cause when I looked at the phpinfo() in the apache2handler category the mod_rewrite module is loaded, so I thought that it was enabled. So I tried searching in google how to enable apache and if enabled how to test if its running. I found a site that taught me how to and when I implement it in my server the program was running. By the way here's the site, it will teach you how to configure mod_rewrite in fedora linux. http://www.inprose.com/articles/7-how-to-enable-modrewrite-in-apache-on-fedora.html Hope other developers that have the same problem that I had can benefit from this. Thanks..
[eluser]chandrajatnika[/eluser]
I don\'t know what do you want to show from that addition() method because it only contain return value... so I think it will not show anything on browser
[eluser]Rey Philip Regis[/eluser]
[quote author="chandrajatnika" date="1232008302"]I don\'t know what do you want to show from that addition() method because it only contain return value... so I think it will not show anything on browser[/quote] Haha yeah it will not show anything, its not return its echo wrong type. But that's not the issue there. The issue is that i can't use clean url's, but when i use the default uri to access controller and method it works. Well, just like what I said on my previous post, it was now solved. The problem was on the apache's configuration in linux, cause in windows machine I have no problems running it. well this case is closed now haha.. Thanks for the reply anyway.. |
Welcome Guest, Not a member yet? Register Sign In |