Unablex to load your default controller. Please make sure the controller specified in your Routes.php file is valid. CodeIgniter

3

This error appears when giving Load in the Initial method:

  

Unablex to load your default controller. Please make sure the   controller specified in your Routes.php file is valid.

And I'm running the localhost project and it works perfectly. But on the server, it does not work. I tried to change the version of PHP to lower or higher, also did not work.

I'm routing using third_party mx

Routes.php

$route['default_controller'] = 'inicial/inicial';
$route['404_override'] = 'inicial/erro';

I tried to substitute initial / initial for just initial. It did not work either. What would be wrong? If locally it works perfectly.

I'm using CodeIgniter to render the project.

    
asked by anonymous 22.11.2015 / 18:31

1 answer

1

As incredible as it sounds, I got the solution like this: Accessing the system / core / codeigniter.php

I looked for the error mentioned:

  

Unablex to load your default controller. Please make sure the   controller specified in your Routes.php file is valid.

and found:

if ( ! file_exists(APPPATH.'controllers/'.$RTR->fetch_directory().$RTR->fetch_class().'.php'))
{
    show_error('Unablex to load your default controller. Please make sure the controller specified in your Routes.php file is valid.');
}

Then replace:

$arquivo = str_replace("..", "", APPPATH.$RTR->fetch_directory().$RTR->fetch_class().'.php');
if ( ! file_exists($arquivo))
{
    show_error('Unablex to load your default controller. Please make sure the controller specified in your Routes.php file is valid.');
}

In this way I forced the framework to look for the file in the "right" way, and in this case it worked.

    
22.11.2015 / 19:11