On Fri, May 16, 2008 at 6:40 PM, Juergen Falb <falb@xxxxxxxxxxxxxxxx> wrote: > Dear all, > since upgrading to php5 I've a problem with session handling. In php4 a > user initiated a session, the session id gets afterwards handed over to a > payment provider. When the payment provider calls a script with the session > id added to the query string, all session data gets loaded and everything > works fine. When I switch to php5 all session data gets lost and the session > file has zero length afterwards. Attached is a short script to verify the > behaviour: > > <?php > session_name('XTCtest'); > if (isset($_GET['sid'])) $sessid = session_id($_GET['sid']); > session_start(); > > if (isset($_GET['set'])) > $_SESSION['customer_id']=$_GET['set']; > > echo "<html><head><title>test</title></head><body>your customer id is " > .$_SESSION['customer_id']." and session id is > ".session_id()."<body></html>"; > ?> > > calling the script from machine 1 with query string "?set=4711" returns the > correct value. > calling the script again from machine 1 without a query string and cookies > enabled works as expected (returns 4711). > > calling the script from machine 2 with query string "?XTCtest=<sessionid>" > or "?sid=<sessionid>" works perfectly on php4 and return 4711. On php5 > session data is lost and nothing is returned. > > Does anybody have a clue what I miss or have to change for php5? > > regards, > Juergen > > P.S: attached are the php.ini setting for php5 > > session.save_handler = files > session.save_path = "/tmp" > session.use_cookies = 1 > session.use_only_cookies = 0 > session.name = PHPSESSID > session.auto_start = 0 > session.cookie_lifetime = 0 > session.cookie_path = / > session.cookie_domain = > session.serialize_handler = php > session.gc_probability = 1 > session.gc_divisor = 1000 > session.gc_maxlifetime = 1440 > session.bug_compat_42 = 1 > session.bug_compat_warn = 1 > session.referer_check = > session.entropy_length = 0 > session.entropy_file = > session.cache_limiter = nocache > session.cache_expire = 180 > session.use_trans_sid = 0 > session.hash_function = 0 > session.hash_bits_per_character = 5 > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > i got the same problem last time. The session lost after i do a page forwarding using the header('Location:') thing.. i fix it by adding session_write_close(); before the header()..