Hi: I am using the latest version of Zend Framework (1.9.3PL1). I set the following in my .ini
; Bootstrap session resources
resources.session.save_path = APPLICATION_PATH "/../data/sessions"
resources.session.use_only_cookies = true
resources.session.remember_me_seconds = 864000
Next I want to initialize my session in my bootstrapper:
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
protected function _initSession()
{
// What goes here!?
}
}
My question is, what goes in the initSession function? What should it return, if anything?
Furthermore, if i just start a session in there, it does not recognize the .ini configuration (e.g., the save_path is unchanged). However, if you move the start to a controller, the .ini configuration is recognized.
EDIT: A possible solution is:
protected function _initSession()
{
// Based on http://framework.zend.com/issues/browse/ZF-6651
$session = $this->getPluginResource('session');
$session->init();
Zend_Session::start();
}
If you use the
resources.session.*-options in your application configuration you must not have a_initSession()method in your bootstrap as these method will override the execution of the plugin resourcesession(Zend_Application_Resource_Session). The sole exitance of theresources.session.*-options in the configuration file will make sure that the session will be initialized according to your options.Please read Zend_Application, Theory of Operation for a detailed discussion about the so-called resource methods and the resource plugins.