CodeIgniter Forums

Full Version: getting a runtime error
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am getting a runtime error: Unable to locate the model you have specified: User



I took a look in /core and I don't have loader.php. But I do have MY_loader.php

Any idea of what is going wrong? Cool
rename MY_loader.php to MY_Loader.php

error is saying that specified Model is not found.
can you share the exact(case sensitive) file and class name of User model.
The problem is that this code runs fine on my Windows PC and also runs fine on my AWS Linux server. So I get the feeling this is a configuration "thing". From the Docs:

Extending Core Class

If all you need to do is add some functionality to an existing library - perhaps add a method or two - then it’s overkill to replace the entire library with your version. In this case it’s better to simply extend the class. Extending a class is nearly identical to replacing a class with a couple exceptions:
  • The class declaration must extend the parent class.

  • Your new class name and filename must be prefixed with MY_ (this item is configurable. See below.).
For example, to extend the native Input class you’ll create a file named application/core/MY_Input.php, and declare your class with:

Looking in config.php I have $config['subclass_prefix'] = 'MY_';

So why would the code be looking for loader.php instead of MY_loader.php? I didn't load composer on the Ubuntu PC. Do I need to?
If the server is case sensitive then you may need to have all the filenames lower case.
Some Linux servers and others are case sensitive.
Interesting that you say that. The exact error I am getting is "unable to locate model you have specified: User." I am not sure where this is coming from (I have a break point in exception handling). It appears to be complaining about line 344 of core/Loader.php but i don't have a file called Loader.php in Core. I do have MY_Loader.php. So why is the MY_ not being pre-pended? I copied the part of the docs that talks about this and it seems that is is a subclass prefix. But where do I tell CI that I want to use the MY_ ?????

BTW, I did find at the bottom of autoload.php I have $autoload['model']=Array('Users');

I have no idea what this is about but it is identical on both the Windows server and on the AWS Linux server.  This seems to be the error. I'd be afraid of deleting that. Anyone know what it is for?
I thought I had the same problem, turns out I had a syntax error in the php file.

Forgot to use my command ...\php\php -l  on the file.
MY_Loader is extending the Loader Class so MY_Loader will call the Loader Class.