Reputation: 19353
I am trying to setup CodeIgniter on my WAMP with PHP 5.3.5 and 2.0.2 CI. My "Hello World" application run successfully (I had only a controller and view). Next I added a Model test.php
class Tests extends CI_Model {
function __construct() {
parent::__contruct();
}
}
I instantiate the model in my controller as:
$this->load->model('Tests');
But I keep getting this error:
It is not safe to rely on the system's timezone settings.
How do I resolve this error? I tried setting date.timezone property in php.ini. I also tried calling date_default_timezone_set
method in index.php of CI. I did go through CI forum but everybody seems to have fixed the issue by calling date_default_timezone_set
. But when I call the method, I don't even get the error. Instead, I get an 500 server error response from Apache!
PHP & CI experts.. I need your help.
Latest Update
I enabled logging to see how things run under the mat. Here is my model:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Hello extends CI_Model {
function __construct()
{
log_message('debug', "Staring Hello Model");
parent::__construct();
log_message('debug', "Done with Hello Model");
}
}
My Controller:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Hello extends CI_Controller {
public function index()
{
//$this->load->view('hello');
echo phpinfo();
}
public function newfun()
{
log_message('debug', "Starting new method...");
$this->load->model('hello');
log_message('debug', "Completed model load...");
$this->load->view('hello');
}
}
And my log file:
DEBUG - 2011-04-18 15:01:44 --> Config Class Initialized
DEBUG - 2011-04-18 15:01:44 --> Hooks Class Initialized
DEBUG - 2011-04-18 15:01:44 --> Utf8 Class Initialized
DEBUG - 2011-04-18 15:01:44 --> UTF-8 Support Enabled
DEBUG - 2011-04-18 15:01:44 --> URI Class Initialized
DEBUG - 2011-04-18 15:01:44 --> Router Class Initialized
DEBUG - 2011-04-18 15:01:44 --> Output Class Initialized
DEBUG - 2011-04-18 15:01:44 --> Security Class Initialized
DEBUG - 2011-04-18 15:01:44 --> Input Class Initialized
DEBUG - 2011-04-18 15:01:44 --> Global POST and COOKIE data sanitized
DEBUG - 2011-04-18 15:01:44 --> Language Class Initialized
DEBUG - 2011-04-18 15:01:44 --> Loader Class Initialized
DEBUG - 2011-04-18 15:01:44 --> Controller Class Initialized
DEBUG - 2011-04-18 15:01:44 --> Starting new method...
DEBUG - 2011-04-18 15:01:44 --> Model Class Initialized
The last log output comes from the constructor of Model.php in ci/system/core folder. There is no indication of my model's controller being executed (I don't see any log message from the model).
What's wrong with my Model? Am I coding it correctly or overlooking something silly?
Upvotes: 0
Views: 2874
Reputation: 58242
It may be a naming conflict? Or a naming issue (CI is very specific about lowercase upper case in model/controller and view names).
Can you try, 'goodbye_model.php' (lowercase) and the main line of the model 'class Goodbye_model extends CI_Model' and load 'Goodbye_model' (uppercase first).
And ensure the filename is lowercase, and the class name is first upper case.
Upvotes: 1