[eluser]JonoB[/eluser]
This one has me completely baffled. I set up a test CI project on my localhost. As part of this, I created a file in application/core/my_controller.php as follows:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
Code:
class MY_Controller extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->output->enable_profiler(TRUE);
$this->session->set_userdata(array('company_id' => 1));
if ( ! $this->tank_auth->is_logged_in())
{
redirect('/auth');
}
}
}
?>
And my controllers then extend this as follows:
Code:
class Products extends MY_Controller
{
function __construct()
{
parent::__construct();
}
function index()
{
//do something here
}
}
And this works absolutely 100% fine.
I then moved my files onto my live webserver, and kept getting a WSOD when trying to load any controller/function. No error message, no 404, nothing. I eventually tracked this down to My_Controller class - it was not autoloading on my live server. So, to double check I put the following line right at the top of each of my controllers:
Code:
require_once '/home/something/public_html/application/core/my_controller.php';
And, voila, all controllers now work fine.
So, why the hell does this work fine in my localhost (xampp running PHP 5.3.1) and not on my live server (PHP Version 5.3.3)? Am I missing something really obvious here?