|  | Posted by Erwin Moller on 06/19/06 12:31 
David Haynes wrote:
 > stathisgotsis@hotmail.com wrote:
 >> Hello everyone,
 >>    I am having a brain fart or something, why won't this work?
 >>
 >> test.php:
 >>
 >> <?php
 >>    session_start();
 >>    $_SESSION['username']='test';
 >       session_write_close();  // <-- add this
 
 Hi David,
 
 Why should that help?
 
 according to php.net:
 [quote]
 
 session_write_close
 
 (PHP 4 >= 4.0.4, PHP 5)
 session_write_close -- Write session data and end session
 Description
 void session_write_close ( void )
 
 End the current session and store session data.
 
 Session data is usually stored after your script terminated without the need
 to call session_write_close(), but as session data is locked to prevent
 concurrent writes only one script may operate on a session at any time.
 When using framesets together with sessions you will experience the frames
 loading one by one due to this locking. You can reduce the time needed to
 load all the frames by ending the session as soon as all changes to session
 variables are done.
 [/quote]
 
 I interpret that as a possibility to quickly close the session if you know
 that you won't need it for the remainder of the script, so concurent
 request on the same session are not put in line to wait for the first
 script to finish.
 
 But since the OP is terminating the script test.php by calling exit(); it
 won't help. I think.
 I am missing something about session_write_close() maybe?
 
 Regards,
 Erwin Moller
 
 
 >>    header("Location: test2.php");
 >>    exit();
 >> ?>
 >>
 >> and test2.php:
 >>
 >> <?php
 >>    session_start();
 >>    echo $_SESSION['username'];
 >> ?>
 >>
 >> Any hint appreciated.
 >>
  Navigation: [Reply to this message] |