500 error on function call in Codeigniter
- by Ilia Lev
I am using just installed CI 2.1.3
Following phpacademy tutorial I wrote in the routes.php:
$route['default_controller'] = "site";
(instead of: $route['default_controller'] = "welcome";)
and in controllers/site.php:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Site extends CI_Controller {
public function index() {
echo "default function started.<br/>";
}
public function hello(){
echo "hello function started.<br/>";
}
}
After uploading it to the server and going to the [www.mydomain.ext] it works ok (writes: "default function started.") BUT if I add 'this-hello();' to the index() function it throws a 500 error.
Why does it happen and how can I resolve this?
Thank you in advance.