I have a problem in codeigniter - after I upload it to the server I am requiring a file in a model from libraries folder
<?php
require_once(APPPATH.'libraries/MY_Model.php');
Class scroll_news_model extends MY_model
{
public function __construct()
{
parent::__construct("scroll_news");
}
}
this code was working fine in my localhost environment but I keep getting this error after I upload it:
Fatal error: require_once() [function.require]: Failed opening required 'application/libraries/MY_Model.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/arab2day/public_html/temp/arab2day/application/models/scroll_news_model.php on line 2
Check the case of your file names; windows makes no difference between ABC.php
and abc.php
, but linux does.
If you are trying to extend the CI_Model
class, MY_Model.php
belongs in the /core
directory rather than /libraries
, and you don't need to include it - it will be loaded automatically when the base model class is loaded.
This is how extending core classes works, extending regular non-essential "libraries" is slightly different. Read more about it here:
http://codeigniter.com/user_guide/general/core_classes.html
As far as the literal problem goes, Lepidosteus makes a good point about case sensitivity and OS, I've run into this issue myself several times.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With