Page 1 of 1

Session : forcing the write ?

Posted: Thu Jan 16, 2003 9:29 am
by F_cha
:(

I have a long PHP script and I want to be able to write to disk the variable created in the session before the script ends
(In fact it seems that PHP even wait until the end of the execution of a function called by register_shutdown_function in order to write the changes to disk...).

Is there a solution, except rewriting personnal handlers of sessions ?

Posted: Thu Jan 16, 2003 10:58 am
by volka
I don't think that is possible even with a user-defined handler.
May I ask why you want this to happen?

Posted: Thu Jan 16, 2003 12:01 pm
by F_cha
Ok,

I order to improve performance, I have to grant resources on a other machine where the client will be redirected.
In fact, a "home prefetch function" is called by register_shutdown_function() at the end of a script PHP.

But if the client reloads its page, my function can be executed several times for a client.

I only wanted to set a flag in the session (even without mutex) to tell that my prefetch function is beeing executed (but the varariable session are only written when the script PHP is over i.e., after the return of my prefetch function )...

Posted: Fri Jan 17, 2003 5:41 am
by volka
I was wrong :oops:

Code: Select all

<pre><?php print_r(get_extension_funcs('session')); ?></pre>
exposed a function suitable for your needs
http://www.php.net/manual/en/function.s ... -close.php