I hope you guys can help me ,
In my Zend application I’m setting the Zend_Auth session files to be saved in a specific folder because I am using a shared hosting. Apparently I have got everything right but the problem is that the sessions are not being stored in the folder I want.
In the application.ini I have:
resources.session.save_path = APPLICATION_PATH "/../data/session/"
resources.session.use_only_cookies = true
In the bootstrap I have:
protected function _initSessions()
{
$this->bootstrap('session');
}
The authentication method
$adapter = $this->getAuthAdapter();
$adapter->setIdentity($userName)->setCredential($hPassword);
$auth = Zend_Auth::getInstance();
$result = $auth->authenticate($adapter);
$user = $this->_userModel->getUserAuthData($userName);
$auth->getStorage()->write($user);
The application authenticates fine but the session files are still being saved in de /tmp folder instead of APPLICATION_PATH “/../data/session/”.
The folder /data/session has chmod 777.
What I am missing here?
After Tim Fountain asked (in the question’s comments) if there was any other session related functionality happening in the bootstrap I decided to check what was happening before bootstrap and found this line in the public/index.php file.
It was just before $application->bootstrap()->run(). I Removed it and it worked.
The problem: Zend_Session::start() was creating the session file without applying any configuration that was being set in the application.ini (because this runs during the bootstrap process).