问题
I have inherited a CI v2.0.2 project.
For development purposes, the project was moved to another subdomain, and the database.php
file has been properly reconfigured.
The login page loads fine. However, after trying to login, I get an error from CI saying:
An Error Was Encountered
Unable to load the requested class: encrypt
In autoload.php
, the database
and session
libraries are autoloaded. This file is the same as in the main codebase.
If I add the encrypt
library in the above line, I’m unable to see the login page at all.
Below is the log file, from loading the login page -
DEBUG - 2012-10-21 04:15:22 --> Config Class Initialized
DEBUG - 2012-10-21 04:15:22 --> Hooks Class Initialized
DEBUG - 2012-10-21 04:15:22 --> Utf8 Class Initialized
DEBUG - 2012-10-21 04:15:22 --> UTF-8 Support Enabled
DEBUG - 2012-10-21 04:15:22 --> URI Class Initialized
DEBUG - 2012-10-21 04:15:22 --> Router Class Initialized
DEBUG - 2012-10-21 04:15:22 --> Output Class Initialized
DEBUG - 2012-10-21 04:15:22 --> Security Class Initialized
DEBUG - 2012-10-21 04:15:22 --> Input Class Initialized
DEBUG - 2012-10-21 04:15:22 --> XSS Filtering completed
DEBUG - 2012-10-21 04:15:22 --> XSS Filtering completed
DEBUG - 2012-10-21 04:15:22 --> XSS Filtering completed
DEBUG - 2012-10-21 04:15:22 --> Global POST and COOKIE data sanitized
DEBUG - 2012-10-21 04:15:22 --> Language Class Initialized
DEBUG - 2012-10-21 04:15:22 --> Loader Class Initialized
DEBUG - 2012-10-21 04:15:22 --> Helper loaded: url_helper
DEBUG - 2012-10-21 04:15:22 --> Database Driver Class Initialized
DEBUG - 2012-10-21 04:15:23 --> Session Class Initialized
DEBUG - 2012-10-21 04:15:23 --> Helper loaded: string_helper
DEBUG - 2012-10-21 04:15:23 --> Session routines successfully run
DEBUG - 2012-10-21 04:15:23 --> Controller Class Initialized
ERROR - 2012-10-21 04:15:23 --> Unable to load the requested class: encrypt
The login works fine when used from the original domain.
Any pointers where I should begin looking?
回答1:
Presumably, the error is a result of one of the following reasons.
1) Somehow the filename of the library managed to chance causing CodeIgniter to be unable to find the file
2) Perhaps the file doesn't exist on the server and once again, CodeIgniter is unable to find it.
3) The filename may be different to that you are referring to in your code.
来源:https://stackoverflow.com/questions/12996881/codeigniter-an-error-was-encountered-unable-to-load-the-requested-class-enc