Welcome Guest, Not a member yet? Register   Sign In
difference between Loader.php and MY_Loader.php
#1

I am getting an error when I load my working code unto a shared host.  see below that I have MY_Loader.php in my core directory but line 344 is trying to use Loader.php. Is there some kind of  prefix configuration that I need to setup?

An uncaught Exception was encountered
Type: RuntimeException
Message: Unable to locate the model you have specified: User
Filename: /home/substant/public_html/rndcontroller/sub_crud/system/core/Loader.php
Line Number: 344
Backtrace:
File: /home/substant/public_html/rndcontroller/sub_crud/application/controllers/Users.php
Line: 18
Function: model

File: /home/substant/public_html/rndcontroller/sub_crud/index.php
Line: 316
Function: require_once
proof that an old dog can learn new tricks
Reply
#2

(This post was last modified: 05-01-2018, 10:31 PM by richb201.)

Well, I tried just renaming MY_Loader.php to Loader.php. Now I get this error:
A PHP Error was encountered
Severity: Error

Message: Class 'CI_Loader' not found

Filename: core/Loader.php

Line Number: 20

Backtrace:

Now to install this application on my server I just copied the sub_crud directory from my local machine to the server. I did NOT do a CI installation on the server. Should I have?
proof that an old dog can learn new tricks
Reply
#3

Check the original error message ...
Message: Unable to locate the model you have specified: User

You might have named your class user.php, when the CI loader is looking for User.php.
Won't matter on Windows, but it does on Linux.
Reply
#4

    I do have a model called user.php. I have attached a directory listing showing a file called sub_crud/application/models/user.php. So how do I fix this? If I rename sub_crud/application/models/user.php to sub_crud/application/models/User.php, might that work? Is it worth a try?
proof that an old dog can learn new tricks
Reply
#5

That is correct. Case sensitivity is a common problem when deploying a site developed on Windows to a server on Linux.
See https://www.codeigniter.com/user_guide/g...ile-naming
Reply
#6

(This post was last modified: 05-02-2018, 07:14 AM by richb201.)

thx. I changed the user.php to User.php in the /model. This seemed to work and i am down to the next problem. I am getting an error:

An Error Was Encountered
Unable to load the requested file: Users/login.php

I never actually use Users/login.php in my code. I have places where I have: 

$this->load->view('Users/login');
and
<li class="active"><li><a href='<?php echo site_url('Users/login')?>'>Login</a></li>
and
redirect('/Users/login/');

But Users/login.php? No.

Any reason this would happen?
proof that an old dog can learn new tricks
Reply
#7

Your first reference, "$this->load->view('Users/login');", is asking CI to load the view file found in "application/views/Users/login.php"
Reply
#8

Your second & third references are linking to
- the *Users* controller (login method) inside "application/controllers", or to
- the *Login* controller (index method) inside "application/controllers/Users"
Reply
#9

Thanks. I changed the first one to upper case "Users/login.php". That seems to take care of it. One more quick question? I have a whole bunch of warnings coming up on my browser screen. How do I turn off this level of warnings? Here is one example:

A PHP Error was encountered
Severity: Warning

Message: session_set_cookie_params(): Cannot change session cookie parameters when headers already sent

Filename: Session/Session.php

Line Number: 296

Backtrace:

File: /home/substant/public_html/rndcontroller/sub_crud/application/core/MY_Loader.php
Line: 284
Function: library

File: /home/substant/public_html/rndcontroller/sub_crud/application/controllers/Users.php
Line: 15
Function: __construct

File: /home/substant/public_html/rndcontroller/sub_crud/index.php
Line: 316
Function: require_once

Do I need to be concerned with going through and fixing every warning, or should I just turn off warnings?
proof that an old dog can learn new tricks
Reply
#10

Fix'm
Reply




Theme © iAndrew 2016 - Forum software by © MyBB