I am new in working with zend so I am facing this problem from the past two days. I have searched a lot but still can not find any solution.
Possible duplicate of Zend Module Bootstrap does not load but it still can not solve my problem.
In my User module everything is working perfect meaning models dbtables controllers but the Bootstrap.
I just want to add user relevant routes into the user module bootstrap I can also add them into the application bootstrap but I do not want to make it a large file.
I have this in my application/modules/User/Bootstrap.php
class User_Bootstrap extends Zend_Application_Module_Bootstrap
{
protected function _initRouter() {
//does not work i think it should work
echo 'joo';
exit;
}
}
As far as I know all bootsrap of modules run every time when we run the application but in my case it doesn't seems to be working.
Update:
in my application/configs/application.ini:
[production]
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
resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/"
resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
resources.modules[] = ""
resources.db.adapter = "Mysqli"
resources.db.params.host = "xxxxx"
resources.db.params.username = "xxxxx"
resources.db.params.password = "xxxxx"
resources.db.params.dbname = "xxxxx"
resources.frontController.actionHelperPaths.Idispatch_Controller_Action_Helper = "Idispatch/Controller/Action/Helper/"
[staging : production]
[testing : production]
resources.cachemanager.database.frontend.options.caching = false
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
[development : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.frontController.params.displayExceptions = 1
Bootstrap in my Application directory:
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap {
protected function _initAutoloaders() {
//user module loader
new Zend_Application_Module_Autoloader(array(
'namespace' => 'User', 'basePath' => APPLICATION_PATH . '/modules/User'
));
}
}
NOTE: I am using ZFW 1
I came here to ask hoping that someone will help me here. Please correct me if I am doing anything wrong. It will be a great appreciation.
Thanks.
I did some tests in my basic ZF1 setup and the only way this does not work is when the filename is not
Bootstrap.php
. In terms of Linux it is also case sensitive.As you mention correctly the modules path is looked at every time and
exit()
is working in my case. Except the file doesn't exist or with the misspelling in the config which you say you fixed.Also you shouldn't need the Autoloader in your main bootstrap but I checked and it doesn't cause this issue.