Page 1 of 1

Sessions error after migrating from 4.4.2 --> 4.4.4.

Posted: Fri Aug 25, 2006 2:24 am
by jgantes
Just this week we moved from a linux based solution (LAMP) to Apache on Windows w/ PHP. Our linux machine was running PHP 4.4.2-1 w/ Apache 1.3.x.

Our Windows box is on PHP 4.4.4 w/ Apache 2.0. Putting the two PHP.INI files side-by-side, and doing the same withthe PHPINFO(), the configurations are identical. It's important to note that everything is WORKING, but now we get an error.

We're now getting this error on Windows w/ Apache and PHP that we never got on either of our Debian based linux servers before:

Notice: A session had already been started - ignoring session_start() in ... line 2


I already checked session.auto_start and this is off. In addition, I don't actually have two sessions initiating.


Note, that when I DOWNGRADE to version 4.4.2 ON WINDOWS this issue goes away as well. Is this a bug or feature by design?

Any ideas?

Thanks!

Posted: Fri Aug 25, 2006 11:33 pm
by jgantes
Ok, it's not a version isssue. Our bad.

We're using this to fix the problem:

if(session_id() == "") session_start();


That way we check for open sessions.


oops.

Posted: Fri Aug 25, 2006 11:49 pm
by RobertGonzalez
You could also use empty() along with session_id() to check your session...

Code: Select all

<?php
session_start();
if (empty(session_id())
{
    session_regenerate_id();
}
// yadda yadda yadda
?>