I'm trying to run my script on a live server, but it is staging.
Locally, everything is fine (OS X), remotely, CentOS/Nginx, I'm having a fatal issue.. the script says that my custom database class cannot be found.
Looking at what's loaded, using get_declared_classes()
, I can definitely see my custom database class, which is being loaded before the script/class that calls it.
It's being loaded through my autoloader:
spl_autoload_register(function ($className) {
if (file_exists(ROOT . DS . 'library' . DS . 'intranet' .DS . 'classes' . DS .strtolower($className) . '.php')){
require_once(ROOT . DS . 'library' . DS . 'intranet' .DS . 'classes' . DS .strtolower($className) . '.php');
} else if (file_exists(ROOT . DS . 'application' . DS . 'controller' . DS . strtolower($className) . '.php')) {
require_once(ROOT . DS . 'application' . DS . 'controller' . DS . strtolower($className) . '.php');
} else if (file_exists(ROOT . DS . 'application' . DS . 'model' . DS . strtolower($className) . '.php')) {
require_once(ROOT . DS . 'application' . DS . 'model' . DS . strtolower($className) . '.php');
} else if (file_exists(ROOT . DS . 'application' . DS . 'view' . DS . strtolower($className) . '.php')) {
require_once(ROOT . DS . 'application' . DS . 'view' . DS . strtolower($className) . '.php');
} else {
throw new Exception("Class: $className not autoloaded!");
}
});
No exception is being thrown.
Array ( [128] => Router
[129] => debug
[130] => database
[131] => SessionManager
[132] => security
)
Fatal error: Class 'database' not found in
/home/nginx/domains/ckrisc/public/library/intranet/classes/sessionmanager.php
on line 76
Bootstrapping and file inclusion are as follows:
require_once (ROOT . DS . 'config' . DS . 'config.php' );
require_once (ROOT . DS . 'config' . DS . 'directories.config.php' );
require_once (library . DS . 'setup.php' );
require_once (library . DS . 'Autoloader.php' );
require_once (library . DS . 'Router.php' );
require_once (library . DS . 'init.php' );
in this case, the class database
is being called from the sessionmanager, which is called in init.php
.
The script is failing here:
$sessionId = database::getInstance()->real_escape_string($sessionId);
Any ideas on what I'm missing here?
也许您在声明autoload函数之前调用了该类。
原来APC 3.1.13引起了一些问题
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.