| 
	
 | 
 Posted by Erwin Moller on 06/19/06 14:45 
David Haynes wrote: 
 
> 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 
>  
 
Hi David, 
 
> 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? 
 
Thanks for your reply. 
I am also a belt and suspenders kind of programmer, but this functioncall  
just doesn't make sense to me in this situation. 
 
But as fas as I understand the matter: It will only write the sessiondata  
away and close the session. But both actions will happen when the script  
ends. 
 
Of course, it is entirely possible I am missing something. 
 
Anyway, let's wait what the OP has to say about it. 
 
Regards, 
Erwin Moller 
 
>  
> -david-
 
  
Navigation:
[Reply to this message] 
 |