|
Posted by David Haynes on 06/19/06 13:11
Erwin Moller wrote:
> 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
I'm a 'belt and suspenders' kind of guy when it comes to this. By using
session_write_close() I know that the data has been flushed into the
cookie prior to ending the program. It just removes one more variable in
the mix.
Having said that, the problem's symptoms could also be explained by
having a setup that is blocking cookies. The session_write_close() is
low hanging fruit so why not try it first?
-david-
Navigation:
[Reply to this message]
|