500 error on function call in Codeigniter

Posted by Ilia Lev on Stack Overflow See other posts from Stack Overflow or by Ilia Lev
Published on 2012-12-18T22:46:54Z Indexed on 2012/12/18 23:03 UTC
Read the original article Hit count: 281

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.

© Stack Overflow or respective owner

Related posts about php

Related posts about codeigniter