linux - zend : Fatal error: Class 'Application_Model_User' not found -
i trying connecting model class defined in /application/models named user.php. following how bootstrap looks like:
class bootstrap extends zend_application_bootstrap_bootstrap{ protected function _initappautoload() { $autoloader = new zend_loader_autoloader_resource(array( 'namespace' => 'application', 'basepath' => application_path, 'resourcetypes' => array( 'model' => array( 'path' => 'models', 'namespace' => 'model', ) ) )); echo '<pre>'; var_dump($autoloader); return $autoloader; }
}
folling application.ini
phpsettings.display_startup_errors = 0 phpsettings.display_errors = 0 includepaths.library = application_path "/../library" bootstrap.path = application_path "/bootstrap.php" bootstrap.class = "bootstrap" appnamespace = "application" resources.frontcontroller.controllerdirectory = application_path "/controllers" resources.frontcontroller.params.displayexceptions = 0
following indexcontroller.php
class indexcontroller extends zend_controller_action { private $user_connection; private $login_status; public function init() { /* initialize action controller here */ $this->user_connection = new application_model_user(); } public function indexaction() { $sql = " select * user"; $this->view->deals = $this->user_connection->select($sql); }
following user.php file:
class application_model_user extends application_model_db_connection { public function __construct() { parent::__construct(); } public function connection(){ return $this->getconnection(); } public function insert($data, $table = 'user'){ return parent::insert($table, $data); } public function select($sql){ return parent::select($sql); }
}
strange part is, developing on windows , runs fine, when push same code ec2 linux instance, fatal error.
fatal error: class 'application_model_user' not found in /var/www/html/dev/application/controllers/indexcontroller.php on line 11
i went through many questions on stack overflow , tried of them, not close solve problem. appreciated.
i able fix above issue, due case sensitivity of linux. renamed models first letter capital , able access them in controller.
user.php -> user.php
also adding subfolder model can add following bootstrap.
protected function _initappautoload() { $autoloader = new zend_loader_autoloader_resource(array( 'namespace' => 'application', 'basepath' => application_path, 'resourcetypes' => array( 'model' => array( 'path' => 'models/', 'namespace' => 'model_', ), 'model_db' => array( 'path' => 'models/db', 'namespace' => 'model_db_' ) ) ));
Comments
Post a Comment