Codeigniter command line error - PHP Fatal error: Class 'CI_Controller' not found

Following the user manual instructions found here: http://ellislab.com/codeigniter/user-guide/general/cli.html I can not run the test script through the command line.

My controller located in / var / www / mysite / application / controller /

    class Tools extends CI_Controller {

    public function message($to = 'World')
    {
        echo "Hello {$to}!".PHP_EOL;
    }
}

In my browser, I can access

http://mysite/tools/message/ben

And the function correctly displays "Hello ben"

From the terminal, I should be able to run:

$ php index.php post "Ben"

My terminal should print: "Hello Ben"

However, I get the following error:

PHP Fatal error: class 'CI_Controller' not found in /var/www/mysite/system/core/CodeIgniter.php on line 233

; ubuntu LAMP. Codeigniter , CI-

PHP /usr/bin/php < - CI usr/bin/php, PHP, , , PHP CI script.

, , .

.

+5
5

! () CodeIgniters.

application/config/config.php config:

$config['log_threshold'] = 0;

$ php index.php.

- , CI CLI PHP, - , , .

+11

"Class" CI_Controller " ", Application -> Config -> database.php, .

+3

:

, , , , - CI_Controller PHP load_class.

, Common.php(, ).

//$_log =& load_class('Log');
require_once('system/libraries/Log.php');
$_log = new CI_Log();

, , . , .

+2

, codeigniter $_SERVER ['PATH_INFO'].

$_ SERVER ['PATH_INFO'] php -. , script , -.

0

The answer provided in this article worked for me.

Inside system/core/CodeIgniter.php, at line 75, change:

set_error_handler('_exception_handler');

to ...

set_exception_handler('_exception_handler');

Other users reported that it gave them better feedback, with which it was possible to debug the main problem, but for me it actually completely fixed the problem.

0
source

All Articles