Welcome Guest, Not a member yet? Register   Sign In
Cannot call functions of Controllers with "ajax" in the name of the Controller
#1

[eluser]Unknown[/eluser]
When trying to use a Controller named "Ajax.php" i ran into the following strange thing:
When i try to call a function in a Controller with "Ajax" in the Name, i get the following error message:

Quote:Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, admin@... and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

The URL i called:
Code:
http://[SERVERNAME]/index.php/fooajaxbar/fnord

The Controller ( system/application/controllers/fooajaxbar.php ) :
Code:
<?php
class Fooajaxbar extends Controller{
    
    function __construct(){
        parent::Controller();
        $this->output->enable_profiler(TRUE);
        echo('construct<br />');
    }
    
    function index(){
        echo('in index');
    }

    function fnord(){
        echo('in fnord');
    }
}
?&gt;

Constructor and index page work well. If i rename the class to Fooajbxbar (and the file to fooajbxbar.php), all works fine, and i can call the function fnord successfully.
( URL:
Code:
http://[SERVERNAME]/index.php/fooajbxbar/fnord
)
#2

[eluser]Mike Ryan[/eluser]
Hi,

Do you have any URL rewriting going on, e.g. mod_rewrite in apache?
#3

[eluser]Derek Allard[/eluser]
There's nothing I can think of in CI that would produce this - if URL rewriting isn't the culprit, is your host doing anything funky?
#4

[eluser]Unknown[/eluser]
Thanks for the answers, i should have checked this issue on another server before posting here...

Well, i tried the same script on another server now, and it runs without error.

So, it really seems it was a server issue, nothing inside CI. Sorry for bothering.
#5

[eluser]Derek Allard[/eluser]
Its no bother at all Korgull, these things come up and its good to have a community to bounce ideas off of. Welcome to CodeIgniter, hope to see you around lots!




Theme © iAndrew 2016 - Forum software by © MyBB