CodeIgniter Forums
getting a runtime error - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forum-5.html)
+--- Forum: General Help (https://forum.codeigniter.com/forum-24.html)
+--- Thread: getting a runtime error (/thread-72787.html)



getting a runtime error - richb201 - 02-11-2019

I am getting a runtime error: Unable to locate the model you have specified: User

system/core/Common.php:653

file=/var/www/html/sub_crud/system/core/loader.php

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


RE: getting a runtime error - neuron - 02-12-2019

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.


RE: getting a runtime error - richb201 - 02-12-2019

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?


RE: getting a runtime error - InsiteFX - 02-12-2019

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.


RE: getting a runtime error - richb201 - 02-12-2019

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?