4

I have upgraded my PHP from version 5.2.9 to 5.3.1 and have encountered the following with my codeigniter application:

Unable to locate the model you have specified: some_model

Codeigniter version 2.1, with HMVC extension Server: Centos 5

The model names are all in lower case and it is also loaded by calling their lower case letter. Everything used to work before the PHP upgrade.

Thiem Nguyen
  • 6,345
  • 7
  • 30
  • 50
WebNovice
  • 2,230
  • 3
  • 24
  • 40

2 Answers2

1

If you are using HMVC, then you have to provide the module name as well.

Like this

$this -> load -> model('module/model_name');
Starx
  • 77,474
  • 47
  • 185
  • 261
  • Eg: Module name is 'module1' Model name : some_model Modle filename : some_model.php How module is loaded: `$this->load->model('module1/some_model');` So, I am using it as you mentioned. It has been working with my previous PHP version, but not with this one. – WebNovice Apr 11 '12 at 12:37
  • @Damchey, When you update your php, may be php.ini got overridden and settings where pushed back to default. – Starx Apr 11 '12 at 12:45
  • Pinpointed the problem. The `My_Loader.php` file was deleted somehow. Sorry. – WebNovice Apr 13 '12 at 15:23
  • @Starx, I've same issue MY_Loader.php is still there. This is working fine in another module. What may be the reasons? Thanks – Mansoorkhan Cherupuzha Feb 07 '13 at 10:07
  • 1
    Yp Got it... Just renamed the module folder name. now it consist only lowercase alphabets – Mansoorkhan Cherupuzha Feb 07 '13 at 10:17
0

Make the second parameter to TRUE:

$this->load->model('modelname', TRUE);
Rapptz
  • 20,807
  • 5
  • 72
  • 86
Hardik Panseriya
  • 523
  • 4
  • 15