I get this error when trying to load a Zend Framework application:
Fatal error: Uncaught exception \'Zend_Session_Exception\' with message \'sessi
had the same error. it occured only if two instances of the same session were used at the same time (e.g. two browser instances were loading at the same time). This is a result of php not being able to handle two open sessions with the same id at the same time.
If you are developing applications with the RPCL library (RADPHP) and you are getting this error:
Application raised an exception class Zend_Session_Exception with message 'session has already been started by session.auto-start or session_start()',
then here is my solution.
You will be surprised how simple it is. Simple include the line
require_once("zcommon.inc.php");
just after the opening PHP tag in the file containing ZAuth component – usually this is the file with a DataModule form. Of course make sure the file zcommon.inc.php is in your path. This will ensure that the Zend session will start first instead of the RPCL session.
Also make sure the name of the php files in your application correspond to the name of the containing classes.
The problem might be related to session.save_path
. You can try ini_set('session.save_path', 'path-to-your-session-storage-directory');
Before this drives you mad, there's probably nothing wrong with your code!
Check your application.ini for the session save path, for me it is APPLICATION_PATH '/session'
Now check you have the correct permissions! If not then cd into the application folder and type
sudo chmod 777 session sudo chown -R [usernamehere] session sudo chgrp -R [usernamehere] session
Job Done!
I had the same problem and searching through all of the posts including this one I couldn't find an answer until I released that although I had the same exception result, my error was caused by something completely different.
I actually had an issue with autoloading. Because of the problem during Bootstrap I believe this caused the exception above to be shown (hiding the real error).
So if you went through all of the other possible fixes, try commenting out the details in your Bootstrap and see if that gets you past this problem. Obviously you slowly bring back the different parts of the bootstrap to uncover the real problem.
For those moving from one server to another. Another issue can be user that apache runs under. I was running a different user on my old box that was set on the new one. I used configs from my old httpd.conf, and forgot to update the permissions on /var/lib/php/session to reflect the different user.
To test, I changed the perms to 777. Everything worked fine, error was gone:
# cd /var/lib/php
# chmod 0777 session
So I returned the perms and changed the group. Of course change newApacheUser to the user account you are running httpd on IF NOT apache.
# chmod 0770 session
# chown root:newApacheUser session
Something to check out if your still having this issue:
Fatal error: Uncaught exception 'Zend_Session_Exception' with message 'session has already been started by session.auto-start or session_start()'