Fatal error: Class 'CI_Controller' not found












2















When I try to access the localhost for my xampp server, an error shows up like this:




Fatal error: Class 'CI_Controller' not found in

C:xampphtdocssystemcoreCodeIgniter.php on line 226




CodeIgniter.php line 222-227:



require BASEPATH.'core/Controller.php';

function &get_instance()
{
return CI_Controller::get_instance();
}


Full CodeIgniter.php



<?php
if (!defined('BASEPATH')) {
exit('No direct script access allowed');
}
/*
* CodeIgniter
*
* An open source application development framework for PHP 5.1.6 or newer
*
* @package CodeIgniter
* @author ExpressionEngine Dev Team
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc.
* @license http://codeigniter.com/user_guide/license.html
* @link http://codeigniter.com
* @since Version 1.0
* @filesource
*/

// ------------------------------------------------------------------------

/*
* System Initialization File
*
* Loads the base classes and executes the request.
*
* @package CodeIgniter
* @subpackage codeigniter
* @category Front-controller
* @author ExpressionEngine Dev Team
* @link http://codeigniter.com/user_guide/
*/

/*
* CodeIgniter Version
*
* @var string
*
*/
define('CI_VERSION', '2.2.0');

/*
* CodeIgniter Branch (Core = TRUE, Reactor = FALSE)
*
* @var boolean
*
*/
define('CI_CORE', false);

/*
* ------------------------------------------------------
* Load the global functions
* ------------------------------------------------------
*/
require BASEPATH.'core/Common.php';

/*
* ------------------------------------------------------
* Load the framework constants
* ------------------------------------------------------
*/
if (defined('ENVIRONMENT') and
file_exists(APPPATH.'config/'.ENVIRONMENT.'/constants.php')) {
require APPPATH.'config/'.ENVIRONMENT.'/constants.php';
} else {
require APPPATH.'config/constants.php';
}

/*
* ------------------------------------------------------
* Define a custom error handler so we can log PHP errors
* ------------------------------------------------------
*/
set_error_handler('_exception_handler');

if (!is_php('5.3')) {
@set_magic_quotes_runtime(0); // Kill magic quotes
}

/*
* ------------------------------------------------------
* Set the subclass_prefix
* ------------------------------------------------------
*
* Normally the "subclass_prefix" is set in the config file.
* The subclass prefix allows CI to know if a core class is
* being extended via a library in the local application
* "libraries" folder. Since CI allows config items to be
* overriden via data set in the main index. php file,
* before proceeding we need to know if a subclass_prefix
* override exists. If so, we will set this value now,
* before any classes are loaded
* Note: Since the config file data is cached it doesn't
* hurt to load it here.
*/
if (isset($assign_to_config['subclass_prefix']) and $assign_to_config['subclass_prefix'] != '') {
get_config(array('subclass_prefix' => $assign_to_config['subclass_prefix']));
}

/*
* ------------------------------------------------------
* Set a liberal script execution time limit
* ------------------------------------------------------
*/
if (function_exists('set_time_limit') == true and @ini_get('safe_mode') == 0) {
@set_time_limit(300);
}

/*
* ------------------------------------------------------
* Start the timer... tick tock tick tock...
* ------------------------------------------------------
*/
$BM = &load_class('Benchmark', 'core');
$BM->mark('total_execution_time_start');
$BM->mark('loading_time:_base_classes_start');

/*
* ------------------------------------------------------
* Instantiate the hooks class
* ------------------------------------------------------
*/
$EXT = &load_class('Hooks', 'core');

/*
* ------------------------------------------------------
* Is there a "pre_system" hook?
* ------------------------------------------------------
*/
$EXT->_call_hook('pre_system');

/*
* ------------------------------------------------------
* Instantiate the config class
* ------------------------------------------------------
*/
$CFG = &load_class('Config', 'core');

// Do we have any manually set config items in the index.php file?
if (isset($assign_to_config)) {
$CFG->_assign_to_config($assign_to_config);
}

/*
* ------------------------------------------------------
* Instantiate the UTF-8 class
* ------------------------------------------------------
*
* Note: Order here is rather important as the UTF-8
* class needs to be used very early on, but it cannot
* properly determine if UTf-8 can be supported until
* after the Config class is instantiated.
*
*/

$UNI = &load_class('Utf8', 'core');

/*
* ------------------------------------------------------
* Instantiate the URI class
* ------------------------------------------------------
*/
$URI = &load_class('URI', 'core');

/*
* ------------------------------------------------------
* Instantiate the routing class and set the routing
* ------------------------------------------------------
*/
$RTR = &load_class('Router', 'core');
$RTR->_set_routing();

// Set any routing overrides that may exist in the main index file
if (isset($routing)) {
$RTR->_set_overrides($routing);
}

/*
* ------------------------------------------------------
* Instantiate the output class
* ------------------------------------------------------
*/
$OUT = &load_class('Output', 'core');

/*
* ------------------------------------------------------
* Is there a valid cache file? If so, we're done...
* ------------------------------------------------------
*/
if ($EXT->_call_hook('cache_override') === false) {
if ($OUT->_display_cache($CFG, $URI) == true) {
exit;
}
}

/*
* -----------------------------------------------------
* Load the security class for xss and csrf support
* -----------------------------------------------------
*/
$SEC = &load_class('Security', 'core');

/*
* ------------------------------------------------------
* Load the Input class and sanitize globals
* ------------------------------------------------------
*/
$IN = &load_class('Input', 'core');

/*
* ------------------------------------------------------
* Load the Language class
* ------------------------------------------------------
*/
$LANG = &load_class('Lang', 'core');

/*
* ------------------------------------------------------
* Load the app controller and local controller
* ------------------------------------------------------
*
*/
// Load the base controller class
require BASEPATH.'core/Controller.php';

function &get_instance()
{
return CI_Controller::get_instance();
}

if (file_exists(APPPATH.'core/'.$CFG->config['subclass_prefix'].'Controller.php')) {
require APPPATH.'core/'.$CFG->config['subclass_prefix'].'Controller.php';
}

// Load the local application controller
// Note: The Router class automatically validates the controller path using the router->_validate_request().
// If this include fails it means that the default controller in the Routes.php file is not resolving to something valid.
if (!file_exists(APPPATH.'controllers/'.$RTR->fetch_directory().$RTR->fetch_class().'.php')) {
show_error('Unable to load your default controller. Please make sure the controller specified in your Routes.php file is valid.');
}

include APPPATH.'controllers/'.$RTR->fetch_directory().$RTR->fetch_class().'.php';

// Set a mark point for benchmarking
$BM->mark('loading_time:_base_classes_end');

/*
* ------------------------------------------------------
* Security check
* ------------------------------------------------------
*
* None of the functions in the app controller or the
* loader class can be called via the URI, nor can
* controller functions that begin with an underscore
*/
$class = $RTR->fetch_class();
$method = $RTR->fetch_method();

if (!class_exists($class)
or strncmp($method, '_', 1) == 0
or in_array(strtolower($method), array_map('strtolower', get_class_methods('CI_Controller')))
) {
if (!empty($RTR->routes['404_override'])) {
$x = explode('/', $RTR->routes['404_override']);
$class = $x[0];
$method = (isset($x[1]) ? $x[1] : 'index');
if (!class_exists($class)) {
if (!file_exists(APPPATH.'controllers/'.$class.'.php')) {
show_404("{$class}/{$method}");
}

include_once APPPATH.'controllers/'.$class.'.php';
}
} else {
show_404("{$class}/{$method}");
}
}

/*
* ------------------------------------------------------
* Is there a "pre_controller" hook?
* ------------------------------------------------------
*/
$EXT->_call_hook('pre_controller');

/*
* ------------------------------------------------------
* Instantiate the requested controller
* ------------------------------------------------------
*/
// Mark a start point so we can benchmark the controller
$BM->mark('controller_execution_time_( '.$class.' / '.$method.' )_start');

$CI = new $class();

/*
* ------------------------------------------------------
* Is there a "post_controller_constructor" hook?
* ------------------------------------------------------
*/
$EXT->_call_hook('post_controller_constructor');

/*
* ------------------------------------------------------
* Call the requested method
* ------------------------------------------------------
*/
// Is there a "remap" function? If so, we call it instead
if (method_exists($CI, '_remap')) {
$CI->_remap($method, array_slice($URI->rsegments, 2));
} else {
// is_callable() returns TRUE on some versions of PHP 5 for private and protected
// methods, so we'll use this workaround for consistent behavior
if (!in_array(strtolower($method), array_map('strtolower', get_class_methods($CI)))) {
// Check and see if we are using a 404 override and use it.
if (!empty($RTR->routes['404_override'])) {
$x = explode('/', $RTR->routes['404_override']);
$class = $x[0];
$method = (isset($x[1]) ? $x[1] : 'index');
if (!class_exists($class)) {
if (!file_exists(APPPATH.'controllers/'.$class.'.php')) {
show_404("{$class}/{$method}");
}

include_once APPPATH.'controllers/'.$class.'.php';
unset($CI);
$CI = new $class();
}
} else {
show_404("{$class}/{$method}");
}
}

// Call the requested method.
// Any URI segments present (besides the class/function) will be passed to the method for convenience
call_user_func_array(array(&$CI, $method), array_slice($URI->rsegments, 2));
}

// Mark a benchmark end point
$BM->mark('controller_execution_time_( '.$class.' / '.$method.' )_end');

/*
* ------------------------------------------------------
* Is there a "post_controller" hook?
* ------------------------------------------------------
*/
$EXT->_call_hook('post_controller');

/*
* ------------------------------------------------------
* Send the final rendered output to the browser
* ------------------------------------------------------
*/
if ($EXT->_call_hook('display_override') === false) {
$OUT->_display();
}

/*
* ------------------------------------------------------
* Is there a "post_system" hook?
* ------------------------------------------------------
*/
$EXT->_call_hook('post_system');

/*
* ------------------------------------------------------
* Close the DB connection if one exists
* ------------------------------------------------------
*/
if (class_exists('CI_DB') and isset($CI->db)) {
$CI->db->close();
}

/* End of file CodeIgniter.php */
/* Location: ./system/core/CodeIgniter.php */


Full Controller.php



<?php
if (!defined('BASEPATH')) {
exit('No direct script access allowed');
}
/**
* CodeIgniter.
*
* An open source application development framework for PHP 5.1.6 or newer
*
* @author ExpressionEngine Dev Team
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc.
* @license http://codeigniter.com/user_guide/license.html
*
* @link http://codeigniter.com
* @since Version 1.0
* @filesource
*/

// ------------------------------------------------------------------------

/**
* CodeIgniter Application Controller Class.
*
* This class object is the super class that every library in
* CodeIgniter will be assigned to.
*
* @category Libraries
*
* @author ExpressionEngine Dev Team
*
* @link http://codeigniter.com/user_guide/general/controllers.html
*/
class CI_Controller
{
private static $instance;

/**
* Constructor.
*/
public function __construct()
{
self::$instance = &$this;

// Assign all the class objects that were instantiated by the
// bootstrap file (CodeIgniter.php) to local class variables
// so that CI can run as one big super object.
foreach (is_loaded() as $var => $class) {
$this->$var = &load_class($class);
}

$this->load = &load_class('Loader', 'core');

$this->load->initialize();

log_message('debug', 'Controller Class Initialized');
}

public static function &get_instance()
{
return self::$instance;
}
}
// END Controller class

/* End of file Controller.php */
/* Location: ./system/core/Controller.php */


thanks for you time










share|improve this question

























  • stackoverflow.com/questions/6758681/…

    – Shafiqul Islam
    Jun 1 '17 at 16:26











  • stackoverflow.com/questions/15207937/…

    – Shafiqul Islam
    Jun 1 '17 at 16:26











  • Please confirm this if I am not mistaken: you want us to fix already tested CodeIgniter code without seeing your code itself?

    – Tpojka
    Jun 1 '17 at 17:32











  • Make sure have named controller files and classes like codeigniter.com/user_guide/general/styleguide.html#file-naming

    – Mr. ED
    Jun 1 '17 at 21:10











  • @ShafiqulIslam the codes that i provided, are what i have on my system but i was seeking to find someone to tell me where is the problem with my code and how to fix it, because i searched and followed many solutions but they didn't work for me.

    – Ilyess Mechlaoui
    Jun 1 '17 at 21:42


















2















When I try to access the localhost for my xampp server, an error shows up like this:




Fatal error: Class 'CI_Controller' not found in

C:xampphtdocssystemcoreCodeIgniter.php on line 226




CodeIgniter.php line 222-227:



require BASEPATH.'core/Controller.php';

function &get_instance()
{
return CI_Controller::get_instance();
}


Full CodeIgniter.php



<?php
if (!defined('BASEPATH')) {
exit('No direct script access allowed');
}
/*
* CodeIgniter
*
* An open source application development framework for PHP 5.1.6 or newer
*
* @package CodeIgniter
* @author ExpressionEngine Dev Team
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc.
* @license http://codeigniter.com/user_guide/license.html
* @link http://codeigniter.com
* @since Version 1.0
* @filesource
*/

// ------------------------------------------------------------------------

/*
* System Initialization File
*
* Loads the base classes and executes the request.
*
* @package CodeIgniter
* @subpackage codeigniter
* @category Front-controller
* @author ExpressionEngine Dev Team
* @link http://codeigniter.com/user_guide/
*/

/*
* CodeIgniter Version
*
* @var string
*
*/
define('CI_VERSION', '2.2.0');

/*
* CodeIgniter Branch (Core = TRUE, Reactor = FALSE)
*
* @var boolean
*
*/
define('CI_CORE', false);

/*
* ------------------------------------------------------
* Load the global functions
* ------------------------------------------------------
*/
require BASEPATH.'core/Common.php';

/*
* ------------------------------------------------------
* Load the framework constants
* ------------------------------------------------------
*/
if (defined('ENVIRONMENT') and
file_exists(APPPATH.'config/'.ENVIRONMENT.'/constants.php')) {
require APPPATH.'config/'.ENVIRONMENT.'/constants.php';
} else {
require APPPATH.'config/constants.php';
}

/*
* ------------------------------------------------------
* Define a custom error handler so we can log PHP errors
* ------------------------------------------------------
*/
set_error_handler('_exception_handler');

if (!is_php('5.3')) {
@set_magic_quotes_runtime(0); // Kill magic quotes
}

/*
* ------------------------------------------------------
* Set the subclass_prefix
* ------------------------------------------------------
*
* Normally the "subclass_prefix" is set in the config file.
* The subclass prefix allows CI to know if a core class is
* being extended via a library in the local application
* "libraries" folder. Since CI allows config items to be
* overriden via data set in the main index. php file,
* before proceeding we need to know if a subclass_prefix
* override exists. If so, we will set this value now,
* before any classes are loaded
* Note: Since the config file data is cached it doesn't
* hurt to load it here.
*/
if (isset($assign_to_config['subclass_prefix']) and $assign_to_config['subclass_prefix'] != '') {
get_config(array('subclass_prefix' => $assign_to_config['subclass_prefix']));
}

/*
* ------------------------------------------------------
* Set a liberal script execution time limit
* ------------------------------------------------------
*/
if (function_exists('set_time_limit') == true and @ini_get('safe_mode') == 0) {
@set_time_limit(300);
}

/*
* ------------------------------------------------------
* Start the timer... tick tock tick tock...
* ------------------------------------------------------
*/
$BM = &load_class('Benchmark', 'core');
$BM->mark('total_execution_time_start');
$BM->mark('loading_time:_base_classes_start');

/*
* ------------------------------------------------------
* Instantiate the hooks class
* ------------------------------------------------------
*/
$EXT = &load_class('Hooks', 'core');

/*
* ------------------------------------------------------
* Is there a "pre_system" hook?
* ------------------------------------------------------
*/
$EXT->_call_hook('pre_system');

/*
* ------------------------------------------------------
* Instantiate the config class
* ------------------------------------------------------
*/
$CFG = &load_class('Config', 'core');

// Do we have any manually set config items in the index.php file?
if (isset($assign_to_config)) {
$CFG->_assign_to_config($assign_to_config);
}

/*
* ------------------------------------------------------
* Instantiate the UTF-8 class
* ------------------------------------------------------
*
* Note: Order here is rather important as the UTF-8
* class needs to be used very early on, but it cannot
* properly determine if UTf-8 can be supported until
* after the Config class is instantiated.
*
*/

$UNI = &load_class('Utf8', 'core');

/*
* ------------------------------------------------------
* Instantiate the URI class
* ------------------------------------------------------
*/
$URI = &load_class('URI', 'core');

/*
* ------------------------------------------------------
* Instantiate the routing class and set the routing
* ------------------------------------------------------
*/
$RTR = &load_class('Router', 'core');
$RTR->_set_routing();

// Set any routing overrides that may exist in the main index file
if (isset($routing)) {
$RTR->_set_overrides($routing);
}

/*
* ------------------------------------------------------
* Instantiate the output class
* ------------------------------------------------------
*/
$OUT = &load_class('Output', 'core');

/*
* ------------------------------------------------------
* Is there a valid cache file? If so, we're done...
* ------------------------------------------------------
*/
if ($EXT->_call_hook('cache_override') === false) {
if ($OUT->_display_cache($CFG, $URI) == true) {
exit;
}
}

/*
* -----------------------------------------------------
* Load the security class for xss and csrf support
* -----------------------------------------------------
*/
$SEC = &load_class('Security', 'core');

/*
* ------------------------------------------------------
* Load the Input class and sanitize globals
* ------------------------------------------------------
*/
$IN = &load_class('Input', 'core');

/*
* ------------------------------------------------------
* Load the Language class
* ------------------------------------------------------
*/
$LANG = &load_class('Lang', 'core');

/*
* ------------------------------------------------------
* Load the app controller and local controller
* ------------------------------------------------------
*
*/
// Load the base controller class
require BASEPATH.'core/Controller.php';

function &get_instance()
{
return CI_Controller::get_instance();
}

if (file_exists(APPPATH.'core/'.$CFG->config['subclass_prefix'].'Controller.php')) {
require APPPATH.'core/'.$CFG->config['subclass_prefix'].'Controller.php';
}

// Load the local application controller
// Note: The Router class automatically validates the controller path using the router->_validate_request().
// If this include fails it means that the default controller in the Routes.php file is not resolving to something valid.
if (!file_exists(APPPATH.'controllers/'.$RTR->fetch_directory().$RTR->fetch_class().'.php')) {
show_error('Unable to load your default controller. Please make sure the controller specified in your Routes.php file is valid.');
}

include APPPATH.'controllers/'.$RTR->fetch_directory().$RTR->fetch_class().'.php';

// Set a mark point for benchmarking
$BM->mark('loading_time:_base_classes_end');

/*
* ------------------------------------------------------
* Security check
* ------------------------------------------------------
*
* None of the functions in the app controller or the
* loader class can be called via the URI, nor can
* controller functions that begin with an underscore
*/
$class = $RTR->fetch_class();
$method = $RTR->fetch_method();

if (!class_exists($class)
or strncmp($method, '_', 1) == 0
or in_array(strtolower($method), array_map('strtolower', get_class_methods('CI_Controller')))
) {
if (!empty($RTR->routes['404_override'])) {
$x = explode('/', $RTR->routes['404_override']);
$class = $x[0];
$method = (isset($x[1]) ? $x[1] : 'index');
if (!class_exists($class)) {
if (!file_exists(APPPATH.'controllers/'.$class.'.php')) {
show_404("{$class}/{$method}");
}

include_once APPPATH.'controllers/'.$class.'.php';
}
} else {
show_404("{$class}/{$method}");
}
}

/*
* ------------------------------------------------------
* Is there a "pre_controller" hook?
* ------------------------------------------------------
*/
$EXT->_call_hook('pre_controller');

/*
* ------------------------------------------------------
* Instantiate the requested controller
* ------------------------------------------------------
*/
// Mark a start point so we can benchmark the controller
$BM->mark('controller_execution_time_( '.$class.' / '.$method.' )_start');

$CI = new $class();

/*
* ------------------------------------------------------
* Is there a "post_controller_constructor" hook?
* ------------------------------------------------------
*/
$EXT->_call_hook('post_controller_constructor');

/*
* ------------------------------------------------------
* Call the requested method
* ------------------------------------------------------
*/
// Is there a "remap" function? If so, we call it instead
if (method_exists($CI, '_remap')) {
$CI->_remap($method, array_slice($URI->rsegments, 2));
} else {
// is_callable() returns TRUE on some versions of PHP 5 for private and protected
// methods, so we'll use this workaround for consistent behavior
if (!in_array(strtolower($method), array_map('strtolower', get_class_methods($CI)))) {
// Check and see if we are using a 404 override and use it.
if (!empty($RTR->routes['404_override'])) {
$x = explode('/', $RTR->routes['404_override']);
$class = $x[0];
$method = (isset($x[1]) ? $x[1] : 'index');
if (!class_exists($class)) {
if (!file_exists(APPPATH.'controllers/'.$class.'.php')) {
show_404("{$class}/{$method}");
}

include_once APPPATH.'controllers/'.$class.'.php';
unset($CI);
$CI = new $class();
}
} else {
show_404("{$class}/{$method}");
}
}

// Call the requested method.
// Any URI segments present (besides the class/function) will be passed to the method for convenience
call_user_func_array(array(&$CI, $method), array_slice($URI->rsegments, 2));
}

// Mark a benchmark end point
$BM->mark('controller_execution_time_( '.$class.' / '.$method.' )_end');

/*
* ------------------------------------------------------
* Is there a "post_controller" hook?
* ------------------------------------------------------
*/
$EXT->_call_hook('post_controller');

/*
* ------------------------------------------------------
* Send the final rendered output to the browser
* ------------------------------------------------------
*/
if ($EXT->_call_hook('display_override') === false) {
$OUT->_display();
}

/*
* ------------------------------------------------------
* Is there a "post_system" hook?
* ------------------------------------------------------
*/
$EXT->_call_hook('post_system');

/*
* ------------------------------------------------------
* Close the DB connection if one exists
* ------------------------------------------------------
*/
if (class_exists('CI_DB') and isset($CI->db)) {
$CI->db->close();
}

/* End of file CodeIgniter.php */
/* Location: ./system/core/CodeIgniter.php */


Full Controller.php



<?php
if (!defined('BASEPATH')) {
exit('No direct script access allowed');
}
/**
* CodeIgniter.
*
* An open source application development framework for PHP 5.1.6 or newer
*
* @author ExpressionEngine Dev Team
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc.
* @license http://codeigniter.com/user_guide/license.html
*
* @link http://codeigniter.com
* @since Version 1.0
* @filesource
*/

// ------------------------------------------------------------------------

/**
* CodeIgniter Application Controller Class.
*
* This class object is the super class that every library in
* CodeIgniter will be assigned to.
*
* @category Libraries
*
* @author ExpressionEngine Dev Team
*
* @link http://codeigniter.com/user_guide/general/controllers.html
*/
class CI_Controller
{
private static $instance;

/**
* Constructor.
*/
public function __construct()
{
self::$instance = &$this;

// Assign all the class objects that were instantiated by the
// bootstrap file (CodeIgniter.php) to local class variables
// so that CI can run as one big super object.
foreach (is_loaded() as $var => $class) {
$this->$var = &load_class($class);
}

$this->load = &load_class('Loader', 'core');

$this->load->initialize();

log_message('debug', 'Controller Class Initialized');
}

public static function &get_instance()
{
return self::$instance;
}
}
// END Controller class

/* End of file Controller.php */
/* Location: ./system/core/Controller.php */


thanks for you time










share|improve this question

























  • stackoverflow.com/questions/6758681/…

    – Shafiqul Islam
    Jun 1 '17 at 16:26











  • stackoverflow.com/questions/15207937/…

    – Shafiqul Islam
    Jun 1 '17 at 16:26











  • Please confirm this if I am not mistaken: you want us to fix already tested CodeIgniter code without seeing your code itself?

    – Tpojka
    Jun 1 '17 at 17:32











  • Make sure have named controller files and classes like codeigniter.com/user_guide/general/styleguide.html#file-naming

    – Mr. ED
    Jun 1 '17 at 21:10











  • @ShafiqulIslam the codes that i provided, are what i have on my system but i was seeking to find someone to tell me where is the problem with my code and how to fix it, because i searched and followed many solutions but they didn't work for me.

    – Ilyess Mechlaoui
    Jun 1 '17 at 21:42
















2












2








2








When I try to access the localhost for my xampp server, an error shows up like this:




Fatal error: Class 'CI_Controller' not found in

C:xampphtdocssystemcoreCodeIgniter.php on line 226




CodeIgniter.php line 222-227:



require BASEPATH.'core/Controller.php';

function &get_instance()
{
return CI_Controller::get_instance();
}


Full CodeIgniter.php



<?php
if (!defined('BASEPATH')) {
exit('No direct script access allowed');
}
/*
* CodeIgniter
*
* An open source application development framework for PHP 5.1.6 or newer
*
* @package CodeIgniter
* @author ExpressionEngine Dev Team
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc.
* @license http://codeigniter.com/user_guide/license.html
* @link http://codeigniter.com
* @since Version 1.0
* @filesource
*/

// ------------------------------------------------------------------------

/*
* System Initialization File
*
* Loads the base classes and executes the request.
*
* @package CodeIgniter
* @subpackage codeigniter
* @category Front-controller
* @author ExpressionEngine Dev Team
* @link http://codeigniter.com/user_guide/
*/

/*
* CodeIgniter Version
*
* @var string
*
*/
define('CI_VERSION', '2.2.0');

/*
* CodeIgniter Branch (Core = TRUE, Reactor = FALSE)
*
* @var boolean
*
*/
define('CI_CORE', false);

/*
* ------------------------------------------------------
* Load the global functions
* ------------------------------------------------------
*/
require BASEPATH.'core/Common.php';

/*
* ------------------------------------------------------
* Load the framework constants
* ------------------------------------------------------
*/
if (defined('ENVIRONMENT') and
file_exists(APPPATH.'config/'.ENVIRONMENT.'/constants.php')) {
require APPPATH.'config/'.ENVIRONMENT.'/constants.php';
} else {
require APPPATH.'config/constants.php';
}

/*
* ------------------------------------------------------
* Define a custom error handler so we can log PHP errors
* ------------------------------------------------------
*/
set_error_handler('_exception_handler');

if (!is_php('5.3')) {
@set_magic_quotes_runtime(0); // Kill magic quotes
}

/*
* ------------------------------------------------------
* Set the subclass_prefix
* ------------------------------------------------------
*
* Normally the "subclass_prefix" is set in the config file.
* The subclass prefix allows CI to know if a core class is
* being extended via a library in the local application
* "libraries" folder. Since CI allows config items to be
* overriden via data set in the main index. php file,
* before proceeding we need to know if a subclass_prefix
* override exists. If so, we will set this value now,
* before any classes are loaded
* Note: Since the config file data is cached it doesn't
* hurt to load it here.
*/
if (isset($assign_to_config['subclass_prefix']) and $assign_to_config['subclass_prefix'] != '') {
get_config(array('subclass_prefix' => $assign_to_config['subclass_prefix']));
}

/*
* ------------------------------------------------------
* Set a liberal script execution time limit
* ------------------------------------------------------
*/
if (function_exists('set_time_limit') == true and @ini_get('safe_mode') == 0) {
@set_time_limit(300);
}

/*
* ------------------------------------------------------
* Start the timer... tick tock tick tock...
* ------------------------------------------------------
*/
$BM = &load_class('Benchmark', 'core');
$BM->mark('total_execution_time_start');
$BM->mark('loading_time:_base_classes_start');

/*
* ------------------------------------------------------
* Instantiate the hooks class
* ------------------------------------------------------
*/
$EXT = &load_class('Hooks', 'core');

/*
* ------------------------------------------------------
* Is there a "pre_system" hook?
* ------------------------------------------------------
*/
$EXT->_call_hook('pre_system');

/*
* ------------------------------------------------------
* Instantiate the config class
* ------------------------------------------------------
*/
$CFG = &load_class('Config', 'core');

// Do we have any manually set config items in the index.php file?
if (isset($assign_to_config)) {
$CFG->_assign_to_config($assign_to_config);
}

/*
* ------------------------------------------------------
* Instantiate the UTF-8 class
* ------------------------------------------------------
*
* Note: Order here is rather important as the UTF-8
* class needs to be used very early on, but it cannot
* properly determine if UTf-8 can be supported until
* after the Config class is instantiated.
*
*/

$UNI = &load_class('Utf8', 'core');

/*
* ------------------------------------------------------
* Instantiate the URI class
* ------------------------------------------------------
*/
$URI = &load_class('URI', 'core');

/*
* ------------------------------------------------------
* Instantiate the routing class and set the routing
* ------------------------------------------------------
*/
$RTR = &load_class('Router', 'core');
$RTR->_set_routing();

// Set any routing overrides that may exist in the main index file
if (isset($routing)) {
$RTR->_set_overrides($routing);
}

/*
* ------------------------------------------------------
* Instantiate the output class
* ------------------------------------------------------
*/
$OUT = &load_class('Output', 'core');

/*
* ------------------------------------------------------
* Is there a valid cache file? If so, we're done...
* ------------------------------------------------------
*/
if ($EXT->_call_hook('cache_override') === false) {
if ($OUT->_display_cache($CFG, $URI) == true) {
exit;
}
}

/*
* -----------------------------------------------------
* Load the security class for xss and csrf support
* -----------------------------------------------------
*/
$SEC = &load_class('Security', 'core');

/*
* ------------------------------------------------------
* Load the Input class and sanitize globals
* ------------------------------------------------------
*/
$IN = &load_class('Input', 'core');

/*
* ------------------------------------------------------
* Load the Language class
* ------------------------------------------------------
*/
$LANG = &load_class('Lang', 'core');

/*
* ------------------------------------------------------
* Load the app controller and local controller
* ------------------------------------------------------
*
*/
// Load the base controller class
require BASEPATH.'core/Controller.php';

function &get_instance()
{
return CI_Controller::get_instance();
}

if (file_exists(APPPATH.'core/'.$CFG->config['subclass_prefix'].'Controller.php')) {
require APPPATH.'core/'.$CFG->config['subclass_prefix'].'Controller.php';
}

// Load the local application controller
// Note: The Router class automatically validates the controller path using the router->_validate_request().
// If this include fails it means that the default controller in the Routes.php file is not resolving to something valid.
if (!file_exists(APPPATH.'controllers/'.$RTR->fetch_directory().$RTR->fetch_class().'.php')) {
show_error('Unable to load your default controller. Please make sure the controller specified in your Routes.php file is valid.');
}

include APPPATH.'controllers/'.$RTR->fetch_directory().$RTR->fetch_class().'.php';

// Set a mark point for benchmarking
$BM->mark('loading_time:_base_classes_end');

/*
* ------------------------------------------------------
* Security check
* ------------------------------------------------------
*
* None of the functions in the app controller or the
* loader class can be called via the URI, nor can
* controller functions that begin with an underscore
*/
$class = $RTR->fetch_class();
$method = $RTR->fetch_method();

if (!class_exists($class)
or strncmp($method, '_', 1) == 0
or in_array(strtolower($method), array_map('strtolower', get_class_methods('CI_Controller')))
) {
if (!empty($RTR->routes['404_override'])) {
$x = explode('/', $RTR->routes['404_override']);
$class = $x[0];
$method = (isset($x[1]) ? $x[1] : 'index');
if (!class_exists($class)) {
if (!file_exists(APPPATH.'controllers/'.$class.'.php')) {
show_404("{$class}/{$method}");
}

include_once APPPATH.'controllers/'.$class.'.php';
}
} else {
show_404("{$class}/{$method}");
}
}

/*
* ------------------------------------------------------
* Is there a "pre_controller" hook?
* ------------------------------------------------------
*/
$EXT->_call_hook('pre_controller');

/*
* ------------------------------------------------------
* Instantiate the requested controller
* ------------------------------------------------------
*/
// Mark a start point so we can benchmark the controller
$BM->mark('controller_execution_time_( '.$class.' / '.$method.' )_start');

$CI = new $class();

/*
* ------------------------------------------------------
* Is there a "post_controller_constructor" hook?
* ------------------------------------------------------
*/
$EXT->_call_hook('post_controller_constructor');

/*
* ------------------------------------------------------
* Call the requested method
* ------------------------------------------------------
*/
// Is there a "remap" function? If so, we call it instead
if (method_exists($CI, '_remap')) {
$CI->_remap($method, array_slice($URI->rsegments, 2));
} else {
// is_callable() returns TRUE on some versions of PHP 5 for private and protected
// methods, so we'll use this workaround for consistent behavior
if (!in_array(strtolower($method), array_map('strtolower', get_class_methods($CI)))) {
// Check and see if we are using a 404 override and use it.
if (!empty($RTR->routes['404_override'])) {
$x = explode('/', $RTR->routes['404_override']);
$class = $x[0];
$method = (isset($x[1]) ? $x[1] : 'index');
if (!class_exists($class)) {
if (!file_exists(APPPATH.'controllers/'.$class.'.php')) {
show_404("{$class}/{$method}");
}

include_once APPPATH.'controllers/'.$class.'.php';
unset($CI);
$CI = new $class();
}
} else {
show_404("{$class}/{$method}");
}
}

// Call the requested method.
// Any URI segments present (besides the class/function) will be passed to the method for convenience
call_user_func_array(array(&$CI, $method), array_slice($URI->rsegments, 2));
}

// Mark a benchmark end point
$BM->mark('controller_execution_time_( '.$class.' / '.$method.' )_end');

/*
* ------------------------------------------------------
* Is there a "post_controller" hook?
* ------------------------------------------------------
*/
$EXT->_call_hook('post_controller');

/*
* ------------------------------------------------------
* Send the final rendered output to the browser
* ------------------------------------------------------
*/
if ($EXT->_call_hook('display_override') === false) {
$OUT->_display();
}

/*
* ------------------------------------------------------
* Is there a "post_system" hook?
* ------------------------------------------------------
*/
$EXT->_call_hook('post_system');

/*
* ------------------------------------------------------
* Close the DB connection if one exists
* ------------------------------------------------------
*/
if (class_exists('CI_DB') and isset($CI->db)) {
$CI->db->close();
}

/* End of file CodeIgniter.php */
/* Location: ./system/core/CodeIgniter.php */


Full Controller.php



<?php
if (!defined('BASEPATH')) {
exit('No direct script access allowed');
}
/**
* CodeIgniter.
*
* An open source application development framework for PHP 5.1.6 or newer
*
* @author ExpressionEngine Dev Team
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc.
* @license http://codeigniter.com/user_guide/license.html
*
* @link http://codeigniter.com
* @since Version 1.0
* @filesource
*/

// ------------------------------------------------------------------------

/**
* CodeIgniter Application Controller Class.
*
* This class object is the super class that every library in
* CodeIgniter will be assigned to.
*
* @category Libraries
*
* @author ExpressionEngine Dev Team
*
* @link http://codeigniter.com/user_guide/general/controllers.html
*/
class CI_Controller
{
private static $instance;

/**
* Constructor.
*/
public function __construct()
{
self::$instance = &$this;

// Assign all the class objects that were instantiated by the
// bootstrap file (CodeIgniter.php) to local class variables
// so that CI can run as one big super object.
foreach (is_loaded() as $var => $class) {
$this->$var = &load_class($class);
}

$this->load = &load_class('Loader', 'core');

$this->load->initialize();

log_message('debug', 'Controller Class Initialized');
}

public static function &get_instance()
{
return self::$instance;
}
}
// END Controller class

/* End of file Controller.php */
/* Location: ./system/core/Controller.php */


thanks for you time










share|improve this question
















When I try to access the localhost for my xampp server, an error shows up like this:




Fatal error: Class 'CI_Controller' not found in

C:xampphtdocssystemcoreCodeIgniter.php on line 226




CodeIgniter.php line 222-227:



require BASEPATH.'core/Controller.php';

function &get_instance()
{
return CI_Controller::get_instance();
}


Full CodeIgniter.php



<?php
if (!defined('BASEPATH')) {
exit('No direct script access allowed');
}
/*
* CodeIgniter
*
* An open source application development framework for PHP 5.1.6 or newer
*
* @package CodeIgniter
* @author ExpressionEngine Dev Team
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc.
* @license http://codeigniter.com/user_guide/license.html
* @link http://codeigniter.com
* @since Version 1.0
* @filesource
*/

// ------------------------------------------------------------------------

/*
* System Initialization File
*
* Loads the base classes and executes the request.
*
* @package CodeIgniter
* @subpackage codeigniter
* @category Front-controller
* @author ExpressionEngine Dev Team
* @link http://codeigniter.com/user_guide/
*/

/*
* CodeIgniter Version
*
* @var string
*
*/
define('CI_VERSION', '2.2.0');

/*
* CodeIgniter Branch (Core = TRUE, Reactor = FALSE)
*
* @var boolean
*
*/
define('CI_CORE', false);

/*
* ------------------------------------------------------
* Load the global functions
* ------------------------------------------------------
*/
require BASEPATH.'core/Common.php';

/*
* ------------------------------------------------------
* Load the framework constants
* ------------------------------------------------------
*/
if (defined('ENVIRONMENT') and
file_exists(APPPATH.'config/'.ENVIRONMENT.'/constants.php')) {
require APPPATH.'config/'.ENVIRONMENT.'/constants.php';
} else {
require APPPATH.'config/constants.php';
}

/*
* ------------------------------------------------------
* Define a custom error handler so we can log PHP errors
* ------------------------------------------------------
*/
set_error_handler('_exception_handler');

if (!is_php('5.3')) {
@set_magic_quotes_runtime(0); // Kill magic quotes
}

/*
* ------------------------------------------------------
* Set the subclass_prefix
* ------------------------------------------------------
*
* Normally the "subclass_prefix" is set in the config file.
* The subclass prefix allows CI to know if a core class is
* being extended via a library in the local application
* "libraries" folder. Since CI allows config items to be
* overriden via data set in the main index. php file,
* before proceeding we need to know if a subclass_prefix
* override exists. If so, we will set this value now,
* before any classes are loaded
* Note: Since the config file data is cached it doesn't
* hurt to load it here.
*/
if (isset($assign_to_config['subclass_prefix']) and $assign_to_config['subclass_prefix'] != '') {
get_config(array('subclass_prefix' => $assign_to_config['subclass_prefix']));
}

/*
* ------------------------------------------------------
* Set a liberal script execution time limit
* ------------------------------------------------------
*/
if (function_exists('set_time_limit') == true and @ini_get('safe_mode') == 0) {
@set_time_limit(300);
}

/*
* ------------------------------------------------------
* Start the timer... tick tock tick tock...
* ------------------------------------------------------
*/
$BM = &load_class('Benchmark', 'core');
$BM->mark('total_execution_time_start');
$BM->mark('loading_time:_base_classes_start');

/*
* ------------------------------------------------------
* Instantiate the hooks class
* ------------------------------------------------------
*/
$EXT = &load_class('Hooks', 'core');

/*
* ------------------------------------------------------
* Is there a "pre_system" hook?
* ------------------------------------------------------
*/
$EXT->_call_hook('pre_system');

/*
* ------------------------------------------------------
* Instantiate the config class
* ------------------------------------------------------
*/
$CFG = &load_class('Config', 'core');

// Do we have any manually set config items in the index.php file?
if (isset($assign_to_config)) {
$CFG->_assign_to_config($assign_to_config);
}

/*
* ------------------------------------------------------
* Instantiate the UTF-8 class
* ------------------------------------------------------
*
* Note: Order here is rather important as the UTF-8
* class needs to be used very early on, but it cannot
* properly determine if UTf-8 can be supported until
* after the Config class is instantiated.
*
*/

$UNI = &load_class('Utf8', 'core');

/*
* ------------------------------------------------------
* Instantiate the URI class
* ------------------------------------------------------
*/
$URI = &load_class('URI', 'core');

/*
* ------------------------------------------------------
* Instantiate the routing class and set the routing
* ------------------------------------------------------
*/
$RTR = &load_class('Router', 'core');
$RTR->_set_routing();

// Set any routing overrides that may exist in the main index file
if (isset($routing)) {
$RTR->_set_overrides($routing);
}

/*
* ------------------------------------------------------
* Instantiate the output class
* ------------------------------------------------------
*/
$OUT = &load_class('Output', 'core');

/*
* ------------------------------------------------------
* Is there a valid cache file? If so, we're done...
* ------------------------------------------------------
*/
if ($EXT->_call_hook('cache_override') === false) {
if ($OUT->_display_cache($CFG, $URI) == true) {
exit;
}
}

/*
* -----------------------------------------------------
* Load the security class for xss and csrf support
* -----------------------------------------------------
*/
$SEC = &load_class('Security', 'core');

/*
* ------------------------------------------------------
* Load the Input class and sanitize globals
* ------------------------------------------------------
*/
$IN = &load_class('Input', 'core');

/*
* ------------------------------------------------------
* Load the Language class
* ------------------------------------------------------
*/
$LANG = &load_class('Lang', 'core');

/*
* ------------------------------------------------------
* Load the app controller and local controller
* ------------------------------------------------------
*
*/
// Load the base controller class
require BASEPATH.'core/Controller.php';

function &get_instance()
{
return CI_Controller::get_instance();
}

if (file_exists(APPPATH.'core/'.$CFG->config['subclass_prefix'].'Controller.php')) {
require APPPATH.'core/'.$CFG->config['subclass_prefix'].'Controller.php';
}

// Load the local application controller
// Note: The Router class automatically validates the controller path using the router->_validate_request().
// If this include fails it means that the default controller in the Routes.php file is not resolving to something valid.
if (!file_exists(APPPATH.'controllers/'.$RTR->fetch_directory().$RTR->fetch_class().'.php')) {
show_error('Unable to load your default controller. Please make sure the controller specified in your Routes.php file is valid.');
}

include APPPATH.'controllers/'.$RTR->fetch_directory().$RTR->fetch_class().'.php';

// Set a mark point for benchmarking
$BM->mark('loading_time:_base_classes_end');

/*
* ------------------------------------------------------
* Security check
* ------------------------------------------------------
*
* None of the functions in the app controller or the
* loader class can be called via the URI, nor can
* controller functions that begin with an underscore
*/
$class = $RTR->fetch_class();
$method = $RTR->fetch_method();

if (!class_exists($class)
or strncmp($method, '_', 1) == 0
or in_array(strtolower($method), array_map('strtolower', get_class_methods('CI_Controller')))
) {
if (!empty($RTR->routes['404_override'])) {
$x = explode('/', $RTR->routes['404_override']);
$class = $x[0];
$method = (isset($x[1]) ? $x[1] : 'index');
if (!class_exists($class)) {
if (!file_exists(APPPATH.'controllers/'.$class.'.php')) {
show_404("{$class}/{$method}");
}

include_once APPPATH.'controllers/'.$class.'.php';
}
} else {
show_404("{$class}/{$method}");
}
}

/*
* ------------------------------------------------------
* Is there a "pre_controller" hook?
* ------------------------------------------------------
*/
$EXT->_call_hook('pre_controller');

/*
* ------------------------------------------------------
* Instantiate the requested controller
* ------------------------------------------------------
*/
// Mark a start point so we can benchmark the controller
$BM->mark('controller_execution_time_( '.$class.' / '.$method.' )_start');

$CI = new $class();

/*
* ------------------------------------------------------
* Is there a "post_controller_constructor" hook?
* ------------------------------------------------------
*/
$EXT->_call_hook('post_controller_constructor');

/*
* ------------------------------------------------------
* Call the requested method
* ------------------------------------------------------
*/
// Is there a "remap" function? If so, we call it instead
if (method_exists($CI, '_remap')) {
$CI->_remap($method, array_slice($URI->rsegments, 2));
} else {
// is_callable() returns TRUE on some versions of PHP 5 for private and protected
// methods, so we'll use this workaround for consistent behavior
if (!in_array(strtolower($method), array_map('strtolower', get_class_methods($CI)))) {
// Check and see if we are using a 404 override and use it.
if (!empty($RTR->routes['404_override'])) {
$x = explode('/', $RTR->routes['404_override']);
$class = $x[0];
$method = (isset($x[1]) ? $x[1] : 'index');
if (!class_exists($class)) {
if (!file_exists(APPPATH.'controllers/'.$class.'.php')) {
show_404("{$class}/{$method}");
}

include_once APPPATH.'controllers/'.$class.'.php';
unset($CI);
$CI = new $class();
}
} else {
show_404("{$class}/{$method}");
}
}

// Call the requested method.
// Any URI segments present (besides the class/function) will be passed to the method for convenience
call_user_func_array(array(&$CI, $method), array_slice($URI->rsegments, 2));
}

// Mark a benchmark end point
$BM->mark('controller_execution_time_( '.$class.' / '.$method.' )_end');

/*
* ------------------------------------------------------
* Is there a "post_controller" hook?
* ------------------------------------------------------
*/
$EXT->_call_hook('post_controller');

/*
* ------------------------------------------------------
* Send the final rendered output to the browser
* ------------------------------------------------------
*/
if ($EXT->_call_hook('display_override') === false) {
$OUT->_display();
}

/*
* ------------------------------------------------------
* Is there a "post_system" hook?
* ------------------------------------------------------
*/
$EXT->_call_hook('post_system');

/*
* ------------------------------------------------------
* Close the DB connection if one exists
* ------------------------------------------------------
*/
if (class_exists('CI_DB') and isset($CI->db)) {
$CI->db->close();
}

/* End of file CodeIgniter.php */
/* Location: ./system/core/CodeIgniter.php */


Full Controller.php



<?php
if (!defined('BASEPATH')) {
exit('No direct script access allowed');
}
/**
* CodeIgniter.
*
* An open source application development framework for PHP 5.1.6 or newer
*
* @author ExpressionEngine Dev Team
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc.
* @license http://codeigniter.com/user_guide/license.html
*
* @link http://codeigniter.com
* @since Version 1.0
* @filesource
*/

// ------------------------------------------------------------------------

/**
* CodeIgniter Application Controller Class.
*
* This class object is the super class that every library in
* CodeIgniter will be assigned to.
*
* @category Libraries
*
* @author ExpressionEngine Dev Team
*
* @link http://codeigniter.com/user_guide/general/controllers.html
*/
class CI_Controller
{
private static $instance;

/**
* Constructor.
*/
public function __construct()
{
self::$instance = &$this;

// Assign all the class objects that were instantiated by the
// bootstrap file (CodeIgniter.php) to local class variables
// so that CI can run as one big super object.
foreach (is_loaded() as $var => $class) {
$this->$var = &load_class($class);
}

$this->load = &load_class('Loader', 'core');

$this->load->initialize();

log_message('debug', 'Controller Class Initialized');
}

public static function &get_instance()
{
return self::$instance;
}
}
// END Controller class

/* End of file Controller.php */
/* Location: ./system/core/Controller.php */


thanks for you time







codeigniter






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jun 1 '17 at 18:49









Stephen King

56011325




56011325










asked Jun 1 '17 at 16:23









Ilyess MechlaouiIlyess Mechlaoui

1113




1113













  • stackoverflow.com/questions/6758681/…

    – Shafiqul Islam
    Jun 1 '17 at 16:26











  • stackoverflow.com/questions/15207937/…

    – Shafiqul Islam
    Jun 1 '17 at 16:26











  • Please confirm this if I am not mistaken: you want us to fix already tested CodeIgniter code without seeing your code itself?

    – Tpojka
    Jun 1 '17 at 17:32











  • Make sure have named controller files and classes like codeigniter.com/user_guide/general/styleguide.html#file-naming

    – Mr. ED
    Jun 1 '17 at 21:10











  • @ShafiqulIslam the codes that i provided, are what i have on my system but i was seeking to find someone to tell me where is the problem with my code and how to fix it, because i searched and followed many solutions but they didn't work for me.

    – Ilyess Mechlaoui
    Jun 1 '17 at 21:42





















  • stackoverflow.com/questions/6758681/…

    – Shafiqul Islam
    Jun 1 '17 at 16:26











  • stackoverflow.com/questions/15207937/…

    – Shafiqul Islam
    Jun 1 '17 at 16:26











  • Please confirm this if I am not mistaken: you want us to fix already tested CodeIgniter code without seeing your code itself?

    – Tpojka
    Jun 1 '17 at 17:32











  • Make sure have named controller files and classes like codeigniter.com/user_guide/general/styleguide.html#file-naming

    – Mr. ED
    Jun 1 '17 at 21:10











  • @ShafiqulIslam the codes that i provided, are what i have on my system but i was seeking to find someone to tell me where is the problem with my code and how to fix it, because i searched and followed many solutions but they didn't work for me.

    – Ilyess Mechlaoui
    Jun 1 '17 at 21:42



















stackoverflow.com/questions/6758681/…

– Shafiqul Islam
Jun 1 '17 at 16:26





stackoverflow.com/questions/6758681/…

– Shafiqul Islam
Jun 1 '17 at 16:26













stackoverflow.com/questions/15207937/…

– Shafiqul Islam
Jun 1 '17 at 16:26





stackoverflow.com/questions/15207937/…

– Shafiqul Islam
Jun 1 '17 at 16:26













Please confirm this if I am not mistaken: you want us to fix already tested CodeIgniter code without seeing your code itself?

– Tpojka
Jun 1 '17 at 17:32





Please confirm this if I am not mistaken: you want us to fix already tested CodeIgniter code without seeing your code itself?

– Tpojka
Jun 1 '17 at 17:32













Make sure have named controller files and classes like codeigniter.com/user_guide/general/styleguide.html#file-naming

– Mr. ED
Jun 1 '17 at 21:10





Make sure have named controller files and classes like codeigniter.com/user_guide/general/styleguide.html#file-naming

– Mr. ED
Jun 1 '17 at 21:10













@ShafiqulIslam the codes that i provided, are what i have on my system but i was seeking to find someone to tell me where is the problem with my code and how to fix it, because i searched and followed many solutions but they didn't work for me.

– Ilyess Mechlaoui
Jun 1 '17 at 21:42







@ShafiqulIslam the codes that i provided, are what i have on my system but i was seeking to find someone to tell me where is the problem with my code and how to fix it, because i searched and followed many solutions but they didn't work for me.

– Ilyess Mechlaoui
Jun 1 '17 at 21:42














3 Answers
3






active

oldest

votes


















2














what will you do?



if just call a controller class. you can write the controller like this.



 <?php
defined('BASEPATH') OR exit('No direct script access allowed');

class YourControllerName extends CI_Controller {

}





share|improve this answer
























  • Only the first letter should be upper case codeigniter.com/user_guide/general/styleguide.html#file-naming

    – Mr. ED
    Jun 1 '17 at 21:10











  • still it doesn't function for me

    – Ilyess Mechlaoui
    Jun 1 '17 at 22:33



















0














I had this issue and the actual cause of this error was my wrong database configuration settings. It was a kind of misleading error message.



Fixing my database configuration settings present inside application/config folder solved the issue for me.



This article was helpful which pointed me to look in the database configuration file.






share|improve this answer

































    0














    I faced the same issue 'Ci_Controller not found in /Codeigniter.php line 234
    with CI framework 2.2.1 version.
    1- I ve downloaded the same project version from github
    2- I moved all of my controllers,models,views,assets from my origin project to the new downloaded project
    Then it's working, unfortunately without knowing the source of the issue.






    share|improve this answer

























      Your Answer






      StackExchange.ifUsing("editor", function () {
      StackExchange.using("externalEditor", function () {
      StackExchange.using("snippets", function () {
      StackExchange.snippets.init();
      });
      });
      }, "code-snippets");

      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "1"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f44312692%2ffatal-error-class-ci-controller-not-found%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      2














      what will you do?



      if just call a controller class. you can write the controller like this.



       <?php
      defined('BASEPATH') OR exit('No direct script access allowed');

      class YourControllerName extends CI_Controller {

      }





      share|improve this answer
























      • Only the first letter should be upper case codeigniter.com/user_guide/general/styleguide.html#file-naming

        – Mr. ED
        Jun 1 '17 at 21:10











      • still it doesn't function for me

        – Ilyess Mechlaoui
        Jun 1 '17 at 22:33
















      2














      what will you do?



      if just call a controller class. you can write the controller like this.



       <?php
      defined('BASEPATH') OR exit('No direct script access allowed');

      class YourControllerName extends CI_Controller {

      }





      share|improve this answer
























      • Only the first letter should be upper case codeigniter.com/user_guide/general/styleguide.html#file-naming

        – Mr. ED
        Jun 1 '17 at 21:10











      • still it doesn't function for me

        – Ilyess Mechlaoui
        Jun 1 '17 at 22:33














      2












      2








      2







      what will you do?



      if just call a controller class. you can write the controller like this.



       <?php
      defined('BASEPATH') OR exit('No direct script access allowed');

      class YourControllerName extends CI_Controller {

      }





      share|improve this answer













      what will you do?



      if just call a controller class. you can write the controller like this.



       <?php
      defined('BASEPATH') OR exit('No direct script access allowed');

      class YourControllerName extends CI_Controller {

      }






      share|improve this answer












      share|improve this answer



      share|improve this answer










      answered Jun 1 '17 at 16:28









      Gilang PratamaGilang Pratama

      105311




      105311













      • Only the first letter should be upper case codeigniter.com/user_guide/general/styleguide.html#file-naming

        – Mr. ED
        Jun 1 '17 at 21:10











      • still it doesn't function for me

        – Ilyess Mechlaoui
        Jun 1 '17 at 22:33



















      • Only the first letter should be upper case codeigniter.com/user_guide/general/styleguide.html#file-naming

        – Mr. ED
        Jun 1 '17 at 21:10











      • still it doesn't function for me

        – Ilyess Mechlaoui
        Jun 1 '17 at 22:33

















      Only the first letter should be upper case codeigniter.com/user_guide/general/styleguide.html#file-naming

      – Mr. ED
      Jun 1 '17 at 21:10





      Only the first letter should be upper case codeigniter.com/user_guide/general/styleguide.html#file-naming

      – Mr. ED
      Jun 1 '17 at 21:10













      still it doesn't function for me

      – Ilyess Mechlaoui
      Jun 1 '17 at 22:33





      still it doesn't function for me

      – Ilyess Mechlaoui
      Jun 1 '17 at 22:33













      0














      I had this issue and the actual cause of this error was my wrong database configuration settings. It was a kind of misleading error message.



      Fixing my database configuration settings present inside application/config folder solved the issue for me.



      This article was helpful which pointed me to look in the database configuration file.






      share|improve this answer






























        0














        I had this issue and the actual cause of this error was my wrong database configuration settings. It was a kind of misleading error message.



        Fixing my database configuration settings present inside application/config folder solved the issue for me.



        This article was helpful which pointed me to look in the database configuration file.






        share|improve this answer




























          0












          0








          0







          I had this issue and the actual cause of this error was my wrong database configuration settings. It was a kind of misleading error message.



          Fixing my database configuration settings present inside application/config folder solved the issue for me.



          This article was helpful which pointed me to look in the database configuration file.






          share|improve this answer















          I had this issue and the actual cause of this error was my wrong database configuration settings. It was a kind of misleading error message.



          Fixing my database configuration settings present inside application/config folder solved the issue for me.



          This article was helpful which pointed me to look in the database configuration file.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Jul 3 '18 at 11:45

























          answered Nov 8 '17 at 9:54









          Mukesh ChapagainMukesh Chapagain

          18.3k1091106




          18.3k1091106























              0














              I faced the same issue 'Ci_Controller not found in /Codeigniter.php line 234
              with CI framework 2.2.1 version.
              1- I ve downloaded the same project version from github
              2- I moved all of my controllers,models,views,assets from my origin project to the new downloaded project
              Then it's working, unfortunately without knowing the source of the issue.






              share|improve this answer






























                0














                I faced the same issue 'Ci_Controller not found in /Codeigniter.php line 234
                with CI framework 2.2.1 version.
                1- I ve downloaded the same project version from github
                2- I moved all of my controllers,models,views,assets from my origin project to the new downloaded project
                Then it's working, unfortunately without knowing the source of the issue.






                share|improve this answer




























                  0












                  0








                  0







                  I faced the same issue 'Ci_Controller not found in /Codeigniter.php line 234
                  with CI framework 2.2.1 version.
                  1- I ve downloaded the same project version from github
                  2- I moved all of my controllers,models,views,assets from my origin project to the new downloaded project
                  Then it's working, unfortunately without knowing the source of the issue.






                  share|improve this answer















                  I faced the same issue 'Ci_Controller not found in /Codeigniter.php line 234
                  with CI framework 2.2.1 version.
                  1- I ve downloaded the same project version from github
                  2- I moved all of my controllers,models,views,assets from my origin project to the new downloaded project
                  Then it's working, unfortunately without knowing the source of the issue.







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Nov 25 '18 at 12:10

























                  answered Nov 25 '18 at 12:04









                  InoubliInoubli

                  588




                  588






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Stack Overflow!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f44312692%2ffatal-error-class-ci-controller-not-found%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Costa Masnaga

                      Fotorealismo

                      Sidney Franklin