Welcome Guest, Not a member yet? Register   Sign In
Class 'MY_Controller' not found
#1

(This post was last modified: 10-25-2018, 06:06 PM by ppuhan1389.)

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

(This post was last modified: 10-26-2018, 12:28 AM by neuron.)

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




Theme © iAndrew 2016 - Forum software by © MyBB