Session : forcing the write ?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
F_cha
Forum Newbie
Posts: 2
Joined: Thu Jan 16, 2003 9:29 am
Location: France - Rouen

Session : forcing the write ?

Post 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 ?
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

I don't think that is possible even with a user-defined handler.
May I ask why you want this to happen?
F_cha
Forum Newbie
Posts: 2
Joined: Thu Jan 16, 2003 9:29 am
Location: France - Rouen

Post 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 )...
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post 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
Post Reply