Sessions error after migrating from 4.4.2 --> 4.4.4.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jgantes
Forum Newbie
Posts: 2
Joined: Fri Aug 25, 2006 2:20 am

Sessions error after migrating from 4.4.2 --> 4.4.4.

Post 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!
jgantes
Forum Newbie
Posts: 2
Joined: Fri Aug 25, 2006 2:20 am

Post 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.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post 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
?>
Post Reply