1

I'm trying to move a website to a new host (MediaTemple.)

When you stick to http, or https everything is fine. When going from http->https or https->http you get the error.

Fatal error: Uncaught exception 'Zend_Session_Exception' with message 'session has already been started by session.auto-start or session_start()' 
    in /var/www/vhosts/FakeSite.com/httpdocs/library/Zend/Session.php:462 
Stack trace: 
#0 /var/www/vhosts/FakeSite.com/httpdocs/library/Zend/Session/Namespace.php(143): Zend_Session::start(true) 
#1 /var/www/vhosts/FakeSite.com/httpdocs/library/Zend/Auth/Storage/Session.php(87): Zend_Session_Namespace->__construct('Zend_Auth') 
#2 /var/www/vhosts/FakeSite.com/httpdocs/library/Zend/Auth.php(91): Zend_Auth_Storage_Session->__construct() 
#3 /var/www/vhosts/FakeSite.com/httpdocs/library/Zend/Auth.php(141): Zend_Auth->getStorage() 
#4 /var/www/vhosts/FakeSite.com/httpdocs/application/layouts/layout.phtml(12): Zend_Auth->hasIdentity() 
#5 /var/www/vhosts/FakeSite.com/httpdocs/library/Zend/View.php(108): include('/var/www/vhosts...') 
#6 /var/www/vhosts/FakeSite.com/httpdocs/library/Zend/View/Abstract.php(831): Zend_View->_run('/var/www/vhosts...') 
#7 /var/www/vh in /var/www/vhosts/FakeSite.com/httpdocs/library/Zend/Session.php on line 462 

Session path is writable, and seems to work fine if you stick to one protocol. There are no session_start() calls, and session.auto-start is 0.

Code is running on 3 other servers fine. It must be a configuration issue, but I haven't been able to find it

Robert
  • 21
  • 1
  • 3

3 Answers3

2

Sure looks like the server is configured with session.auto_start = 1.

So, maybe add to configs/application.ini:

phpSettings.session.auto_start = 0
David Weinraub
  • 14,144
  • 4
  • 42
  • 64
  • I had already confirmed session.auto_start = 0 in both local and master, but I tried adding that line to the application.ini anyway. Still getting the same error. – Robert Apr 06 '11 at 13:55
2

I think you have a plugin(or other library), which calls session_start() function

I had the same problem, when tried to create facebook resource

hhs
  • 716
  • 1
  • 6
  • 22
  • 2
    that is the problem definitely: the facebook php sdk is trying to start a session with the standard php session_start() and it's interfering with the Zend Framework's own session handler. – Tamas Kalman May 03 '12 at 04:01
  • Just solved such issue: I've put $auth->getStorage(); in the bootstrap, before FB init. – Max Chernopolsky Feb 20 '15 at 16:47
1

I figured finally it out.

Problem was that PHP on http was running as an Apache module, and PHP on https was running as a FastCGI module.

I assume those run as different users on MediaTemple or something. The session would get created by one, and not be able to be read by the other because another user owned the file.

Robert
  • 21
  • 1
  • 3