Session initialization issue

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
miro_igov
Forum Contributor
Posts: 485
Joined: Fri Mar 31, 2006 5:06 am
Location: Bulgaria

Session initialization issue

Post by miro_igov »

Hello,

I wonder if someone have experience with starting a session in another browser with an ID of a valid session. I am trying to implement SWFUpload on a server and because flash have it's own cookie container i need to pass the session ID to it so it can start the same session as in the browser and use the session variables. This works ok on some servers, but not on others. Example:

st1.php

Code: Select all

 
<?php
    session_start();
    $_SESSION['test'] = 'QWERTY';
    
    echo session_id();
?>
 
st2.php

Code: Select all

 
<?php
    session_id($_GET['sid']);
    
    session_start();
    
    print_r($_SESSION);
?>
 
st2.php is called by http://domain.com/st2.php?sid=5344e919b ... f317becdfc , the id of the session is obtained from the echo in st1.php

The problem is that running st1.php and http://domain.com/st2.php?sid=5344e919b ... f317becdfc in same browser (FireFox) works ok and in the 2nd file i am able to see the session. But if i run http://domain.com/st2.php?sid=5344e919b ... f317becdfc in IE session is empty. Again this works fine in some servers (IE displays the session content from the 2nd file), and on other servers the session is empty.

Is there a php.ini config variable that deals here?
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: Session initialization issue

Post by Benjamin »

Without looking too deep it looks fine to me. Have you verified that sid is populated and correct on st2.php? Your files are all on the same box right?
Post Reply