Zend Uncaught exception

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 
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): 
 #2 /var/www/library/Zend/Controller/Action/HelperBroker.php(372): 
 #3 /var/www/library/Zend/Controller/Action/HelperBroker.php(155): 
 .. 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.




About Peter Connolly

Pete Connolly is Technical Director at KP Direction LLC. An experienced IT Manager and PHP developer, Peter is currently develops leading-edge Drupal solutions for companies that you'll have heard of, if only we could tell you who they are. More..