Welcome Guest, Not a member yet? Register   Sign In
getting a runtime error
#1
Smile 

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
proof that an old dog can learn new tricks
Reply
#2

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.
Reply
#3

(This post was last modified: 02-12-2019, 05:32 AM by richb201.)

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?
proof that an old dog can learn new tricks
Reply
#4

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.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#5

(This post was last modified: 02-12-2019, 10:36 AM by richb201.)

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?
proof that an old dog can learn new tricks
Reply
#6

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.
I wrote my first program in 15 minutes. It took me 3 hours to keypunch it.

I wrote my first BASH script in 5 minutes. It took me a day to find out I had to put a . (period) in front of it to get it to execute.
Reply
#7

MY_Loader is extending the Loader Class so MY_Loader will call the Loader Class.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply




Theme © iAndrew 2016 - Forum software by © MyBB