Error on upgrade to 0.4.2: session has already been started by session.auto-start or session_start()

I just went through the automatic upgrade process to move from 0.4.1 to 0.4.2.

It seemed like a smooth process, upgrading the php and the database.

However, I get the following error when I try to access the piwik admin interface now:


session has already been started by session.auto-start or session_start()
Backtrace:

#0 /var/www/html/piwik/libs/Zend/Session/Namespace.php(116): Zend_Session::start(true)
#1 /var/www/html/piwik/plugins/LanguagesManager/LanguagesManager.php(129): Zend_Session_Namespace->__construct(‘LanguagesManage…’)
#2 /var/www/html/piwik/plugins/LanguagesManager/LanguagesManager.php(96): Piwik_LanguagesManager::getLanguageFromPreferences()
#3 /var/www/html/piwik/plugins/LanguagesManager/LanguagesManager.php(51): Piwik_LanguagesManager::getLanguageCodeForCurrentUser()
#4 [internal function]: Piwik_LanguagesManager->getLanguageToLoad(Object(Piwik_Event_Notification))
#5 /var/www/html/piwik/libs/Event/Dispatcher.php(284): call_user_func_array(Array, Array)
#6 /var/www/html/piwik/core/PluginsManager.php(491): Event_Dispatcher->postNotification(Object(Piwik_Event_Notification), true, false)
#7 /var/www/html/piwik/core/Translate.php(76): Piwik_PostEvent(‘Translate.getLa…’, NULL)
#8 /var/www/html/piwik/core/Translate.php(43): Piwik_Translate->getLanguageToLoad()
#9 /var/www/html/piwik/core/FrontController.php(230): Piwik_Translate->loadUserTranslation()
#10 /var/www/html/piwik/index.php(52): Piwik_FrontController->init()
#11 {main}

I am running on a linux box. I tried restarting apache and mysql, but that didn’t seem to change anything.

Mysql info:
mysql Ver 14.7 Distrib 4.1.22, for pc-linux-gnu (i686) using readline 4.3

Apache info:
Server version: Apache/2.0.52
Server built: Jun 29 2007 05:07:13

I searched through the developer issue system and didn’t find the bug. I wasn’t sure if I should just file it there.

The issue only appears to be with the admin software, at least the call to piwik.php when I view a page on my site is returning a 200 in the logs.

Do I need to upgrade Zend? I tried creating tmp/logs in my piwik directory, but no output was put there.

Thanks for some great software!

Dan

Sorry, this is fixed in svn and will be released in the next update/build. It is non-fatal and can be safely ignored.

Hi,

Do you know when a release is expected? I can’t get to my reports right now–is there a work around?

Thanks.

After some discussion, this is now a wontfix.

Create a .htaccess with the following rule:

php_flag session.auto_start off

Or disable it php.ini.

Great, thanks. This fixed worked fine for me.

Cheers.

Hello,

i got the same problem:


session has already been started by session.auto-start or session_start()
Backtrace:

#0 /var/www/vhosts/nowakom.net/subdomains/Michael/httpdocs/piwik/libs/Zend/Session/Namespace.php(116): Zend_Session::start(true)
#1 /var/www/vhosts/nowakom.net/subdomains/Michael/httpdocs/piwik/plugins/LanguagesManager/API.php(178): Zend_Session_Namespace->__construct(‘Piwik_Languages…’)
#2 /var/www/vhosts/nowakom.net/subdomains/Michael/httpdocs/piwik/plugins/LanguagesManager/LanguagesManager.php(136): Piwik_LanguagesManager_API::getLanguageForSession()
#3 /var/www/vhosts/nowakom.net/subdomains/Michael/httpdocs/piwik/plugins/LanguagesManager/LanguagesManager.php(103): Piwik_LanguagesManager::getLanguageFromPreferences()
#4 /var/www/vhosts/nowakom.net/subdomains/Michael/httpdocs/piwik/plugins/LanguagesManager/LanguagesManager.php(62): Piwik_LanguagesManager::getLanguageCodeForCurrentUser()
#5 [internal function]: Piwik_LanguagesManager->getLanguageToLoad(Object(Piwik_Event_Notification))
#6 /var/www/vhosts/nowakom.net/subdomains/Michael/httpdocs/piwik/libs/Event/Dispatcher.php(282): call_user_func_array(Array, Array)
#7 /var/www/vhosts/nowakom.net/subdomains/Michael/httpdocs/piwik/core/PluginsManager.php(501): Event_Dispatcher->postNotification(Object(Piwik_Event_Notification), true, false)
#8 /var/www/vhosts/nowakom.net/subdomains/Michael/httpdocs/piwik/core/Translate.php(76): Piwik_PostEvent(‘Translate.getLa…’, NULL)
#9 /var/www/vhosts/nowakom.net/subdomains/Michael/httpdocs/piwik/core/Translate.php(43): Piwik_Translate->getLanguageToLoad()
#10 /var/www/vhosts/nowakom.net/subdomains/Michael/httpdocs/piwik/core/FrontController.php(230): Piwik_Translate->loadUserTranslation()
#11 /var/www/vhosts/nowakom.net/subdomains/Michael/httpdocs/piwik/index.php(57): Piwik_FrontController->init()
#12 {main}


i created a “.htaccess” with just one line:
“php_flag session.auto_start off” and took it to the piwik-root.

is this correct? nothing happend … still the same prob.
I have no access to php.ini … it’s an provider-webspace style_emoticons/<#EMO_DIR#>/sad.gif

need help.

greetings
cappy

cappy: your hosting provider might allow you to override this using a php.ini file in your hosting account’s home directory.

Hello,

just nearly 3 weeks later the support did answer me.
the “php_flag session.auto_start off” ist set on the server.
I used php-info to check it.

it is right … but the problem is still the same.
what shall i do?

thx
cappy

cappy: That shouldn’t be possible looking at the Zend Session code. What do you have session.save_handler and session.save_path set to?

Hello,

session.save_handler is "files"
session.save_path is “/var/lib/php5”

is this okay?

thx cappy

Sorry, cappy. It appears the problem is that your host is running php 5.2.0. According to the ZF guys, there’s a bug in php 5.2.0 that prevents Zend_Session from working.

See point #4 of:

http://framework.zend.com/wiki/display/ZFDEV2/Zend_Session+2.0

hey,

thanks for this quickly reply.
My english is noct very well, so it’s hard to understand the text at your posted link.
It seems, i have to whait for a php-fix and for my provider updateing php!?

Is it right?

thx cappy

Yes. Your host needs to update to a newer version of php.

Hi,
my Provider can’t, may don’t wants, to up- or downgrade the PHP-Version.
Is it possible to DOWNGRADE Piwik by a routine without re-install the complete system?

The former version of piwik was running good.

thx cappy

P.S.: Don’t be scared of my english. I think it’s terrible, bin I try my best.

You could try commenting out the Zend_Session::start(true) call in libs/Zend/Session/Namespace.php …

If you want to rollback to an older, unsupported version, check out http://builds.piwik.org

I have also a similar problem. I wanted to install Piwik 0.5.4 an a new site. It’s hosted at the same server (shared hosting) as our other site. At the other site I have Piwik 0.4.5 running with no problems. I also tried 0.4.5 at the new site but I get the same error as with 0.5.4:

Fatal error: Uncaught exception 'Zend_Session_Exception' with message 'session has already been started by session.auto-start or session_start()' in /home/xxxxx/htmldocs/piwik/libs/Zend/Session.php:462 Stack trace: #0 /home/xxxxx/htmldocs/piwik/index.php(89): Zend_Session::start() #1 {main} thrown in /home/xxxxxx/htmldocs/piwik/libs/Zend/Session.php on line 462

I tried the .htaccess with “php_flag session.auto_start off” but it doesn’t help. I have no access to the php.ini. It’s curious that Piwik works at our other site and not at the new one at the same server.