• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Class 'MY_Controller' not found

#1
I have a my controller in application/core
<?php 
class MY_Controller extends CI_Controller {



function __construct() {
parent::__construct();
$this->load->model('loginModel');
$this->load->library('session');
$this->load->library('email');
   .....
}



public function _show_homebasic(){
            $data=array();
            $data['SiteImagesURL']=$this->config->item('SiteImagesURL');
            $data['SiteCustomCSSURL']=$this->config->item('SiteCustomCSSURL');
            $data['SiteCustomJSURL']=$this->config->item('SiteCustomJSURL');
            $data['SiteVendorURL']=$this->config->item('SiteVendorURL');
return $data;

}

}

?>



Now in application/controller directory is have 


<?php

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

    class Test extends MY_Controller {


  function __construct() {
                parent::__construct();
                $this->load->library('session');
$this->load->library('email');
            }




/*

* Function type : index
* Function desc : Shows the main Page
 
*/

 public function index()
        {
     echo "hello";  

        }
}

?>


while running the site in  linux server i am getting below error



Fatal error: Class 'MY_Controller' not found in /home/vritipgc/public_html/application/controllers/Test.php on line 5
A PHP Error was encountered
Severity: Error
Message: Class 'MY_Controller' not found
Filename: controllers/Test.php
Line Number: 5
Backtrace:



Please Help
Reply

#2
Application core Controller file name should be exactly: 
MY_Controller.php

also in application/config/config.php:
PHP Code:
$config['subclass_prefix'] = 'MY_'
Reply

#3
(10-25-2018, 11:26 PM)neuron Wrote: Application core Controller file name should be exactly: 
MY_Controller.php

also in application/config/config.php:
PHP Code:
$config['subclass_prefix'] = 'MY_'

Yes, its the same. But still the issue persists
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.