[PHP] register_shutdown_function - uses for

2001-04-10 Thread Greig, Euan

I was hoping that I could use this function to enable me to finish scripts tidily when 
they time out or are aborted by the user. eg display the message "script timed out". 
However this will not work as no output is allowed in the shutdown function. I can see 
other ways to do what I want (but suggestions would always be welcome) but the real 
point of this email is this: what sort of thing would you use 
register_shutdown_function to achieve?

Euan Greig
Technical Consultant
BRANN DATA
[EMAIL PROTECTED]
01285 645997





**
Any opinions expressed in this email are those of the individual and 
not necessarily the Company. This email and any files transmitted with 
it, including replies and forwarded copies (which may contain alterations) 
subsequently transmitted from the Company, are confidential and solely for 
the use of the intended recipient. If you are not the intended recipient 
or the person responsible for delivering to the intended recipient, be 
advised that you have received this email in error and that any use is 
strictly prohibited.

**

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] register_shutdown_function - uses for

2001-04-10 Thread elias

Hmm so you can't print?!
can you redirect?

Header("Location: mymessage.html");

-elias
http://www.kameelah.org/eassoft

""Greig, Euan"" [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I was hoping that I could use this function to enable me to finish scripts
tidily when they time out or are aborted by the user. eg display the message
"script timed out". However this will not work as no output is allowed in
the shutdown function. I can see other ways to do what I want (but
suggestions would always be welcome) but the real point of this email is
this: what sort of thing would you use register_shutdown_function to
achieve?

 Euan Greig
 Technical Consultant
 BRANN DATA
 [EMAIL PROTECTED]
 01285 645997





 **
 Any opinions expressed in this email are those of the individual and
 not necessarily the Company. This email and any files transmitted with
 it, including replies and forwarded copies (which may contain alterations)
 subsequently transmitted from the Company, are confidential and solely for
 the use of the intended recipient. If you are not the intended recipient
 or the person responsible for delivering to the intended recipient, be
 advised that you have received this email in error and that any use is
 strictly prohibited.

 **

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] register_shutdown_function - uses for

2001-04-10 Thread Steve Werby

"Greig, Euan" [EMAIL PROTECTED] wrote:
 I was hoping that I could use this function to enable me to finish scripts
tidily
 when they time out or are aborted by the user. eg display the message
"script
 timed out". However this will not work as no output is allowed in the
shutdown
 function. I can see other ways to do what I want (but suggestions would
 always be welcome) but the real point of this email is this: what sort of
thing
 would you use register_shutdown_function to achieve?

I've used it for database inserts or calls to external programs that took a
long time, but did not affect the output sent to the browser.  In those
cases I used register_shutdown_function() inside a control structure to call
another function (after outputting HTML from within the same control
structure).

--
Steve Werby
President, Befriend Internet Services LLC
http://www.befriend.com/



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] register_shutdown_function - uses for

2001-04-10 Thread CC Zona

In article 
[EMAIL PROTECTED],
 [EMAIL PROTECTED] ("Greig, Euan") wrote:

 I was hoping that I could use this function to enable me to finish scripts 
 tidily when they time out or are aborted by the user. eg display the message 
 "script timed out". However this will not work as no output is allowed in the 
 shutdown function. I can see other ways to do what I want (but suggestions 
 would always be welcome) but the real point of this email is this: what sort 
 of thing would you use register_shutdown_function to achieve?

Not a fancy example, but...

I use it in a script which loops through a database of urls to validate 
them.  With each loop, set_time_limit gets reset for a length of time more 
than sufficient for processing a valid url.  If an iteration takes too 
long, the script will timeout and die without an error message.  Since in 
this case timeout  == bad url, register_shutdown_function() allows me to 
send a final query back to the database marking the current url as invalid.  
Otherwise, when I start the script up again it would always have that same 
url sitting at the top of the processing list where it would just timeout 
over and over again (which is what it used to do--what a PITA).

You could also use register_shutdown_function() to, for instance, email 
yourself information about why a script terminated and what state it was 
left in.  Output to the *browser is disallowed, but output to other 
destinations (logs, email, filesystem, databases, etc.) still works.  You 
can take advantage of that.

-- 
CC

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] register_shutdown_function - uses for

2001-04-10 Thread Yasuo Ohgaki

For another example use of shutdown function.
Take a look at how PEAR destructor is implemented. It's using shutdown function.

Regards,
--
Yasuo Ohgaki


""Greig, Euan"" [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I was hoping that I could use this function to enable me to finish scripts
tidily when they time out or are aborted by the user. eg display the message
"script timed out". However this will not work as no output is allowed in the
shutdown function. I can see other ways to do what I want (but suggestions would
always be welcome) but the real point of this email is this: what sort of thing
would you use register_shutdown_function to achieve?

 Euan Greig
 Technical Consultant
 BRANN DATA
 [EMAIL PROTECTED]
 01285 645997





 **
 Any opinions expressed in this email are those of the individual and
 not necessarily the Company. This email and any files transmitted with
 it, including replies and forwarded copies (which may contain alterations)
 subsequently transmitted from the Company, are confidential and solely for
 the use of the intended recipient. If you are not the intended recipient
 or the person responsible for delivering to the intended recipient, be
 advised that you have received this email in error and that any use is
 strictly prohibited.

 **

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]