Zend doesn’t always give the most accurate error messages. Here’s a great example I found today; I moved a Zend site on my server, and everything looked OK until I tried to run it; when it gave me the following useful message;

 

 

 

 

 

 

Fatal error: Uncaught exception 'Zend_Session_Exception' with message 'session has 
already been started by session.auto-start or session_start()' in 
/var/www/library/Zend/Session.php:462
Stack trace:
#0 /var/www/library/Zend/Session/Namespace.php(143): Zend_Session::start(true)
#1 /var/www/library/Zend/Controller/Action/Helper/FlashMessenger.php(82): 
Zend_Session_Namespace->__construct('FlashMessenger')
 #2 /var/www/library/Zend/Controller/Action/HelperBroker.php(372): 
Zend_Controller_Action_Helper_FlashMessenger->__construct()
 #3 /var/www/library/Zend/Controller/Action/HelperBroker.php(155): 
Zend_Controller_Action_HelperBroker::_loadHelper('FlashMessenger')
 .. etc, down into my application.

 

Now, looking at the error message, it implies that there is something going on with session variables. Normally with PHP that’s where I’d start looking – searching out a session_start() or similar in the code. But in this case, don’t bother…. that’s not where the error comes from.

The solution? We didn’t have a writeable  folder assigned for sessions. I created a folder /var/www/session, writable by the apache user, and then added the following line to the site definition;

# PHP Settings
 php_value session.save_path /var/www/session

Restarted Apache, and all was fine.