RE: [PHP] REGISTER_SHUTDOWN_FUNCTION() BUG -- Please Fix.
I'm not sure if that's a bug, it's more of a feature request. ---John Holmes... -Original Message- From: Jason Caldwell [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 17, 2002 3:24 AM To: [EMAIL PROTECTED] Subject: [PHP] REGISTER_SHUTDOWN_FUNCTION() BUG -- Please Fix. I'm posting this here to give this BUG attention. It's a pretty serious one for Win32 users, and it would be great if it could be fixed *very quickly* -- I posted this in the Bug Reports on PHP.net on May 27th, 2002. Here's the link: http://bugs.php.net/bug.php?id=17461 I need to use this function to perform certain *required* tasks on a Timeout -- however (and please read the Bug Report, before replying) the Timeout functionality of this function DOES NOT work on Win32 builds. If your a C/C++ / PHP contributor and have a moment to look into this -- it would be great -- I would love to see this fixed in release 4.2.4 !!! Thanks Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] REGISTER_SHUTDOWN_FUNCTION() BUG -- Please Fix.
Hey, Jason, since you really need this BUG fixed, and the PHP developers would welcome good, well-documented, and tested code ... Why not devote some of your precious time to helping them along? If _you_ write, document, and test the code, and then pass the code to the development team you'll stand a much better chance of getting it included in a future version - along with solving your current problem _and_ getting your name in the list of contributors. Mark C. -Original Message- From: John Holmes [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 17, 2002 8:12 AM To: 'Jason Caldwell'; [EMAIL PROTECTED] Subject: RE: [PHP] REGISTER_SHUTDOWN_FUNCTION() BUG -- Please Fix. I'm not sure if that's a bug, it's more of a feature request. ---John Holmes... -Original Message- From: Jason Caldwell [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 17, 2002 3:24 AM To: [EMAIL PROTECTED] Subject: [PHP] REGISTER_SHUTDOWN_FUNCTION() BUG -- Please Fix. I'm posting this here to give this BUG attention. It's a pretty serious one for Win32 users, and it would be great if it could be fixed *very quickly* -- I posted this in the Bug Reports on PHP.net on May 27th, 2002. Here's the link: http://bugs.php.net/bug.php?id=17461 I need to use this function to perform certain *required* tasks on a Timeout -- however (and please read the Bug Report, before replying) the Timeout functionality of this function DOES NOT work on Win32 builds. If your a C/C++ / PHP contributor and have a moment to look into this -- it would be great -- I would love to see this fixed in release 4.2.4 !!! Thanks Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] REGISTER_SHUTDOWN_FUNCTION() BUG -- Please Fix.
It's a bug. spoke to Rasmus at some length about just before i posted it in the bug report. The online help page is inaccurate in describing the full functionality of the function: http://www.php.net/manual/en/function.register-shutdown-function.php REGISTER_SHUTDOWN_FUNCTION() is suppose to kick-off when any one of the following things happen -- Exit, Error, TIMEOUT or User Abort. According to Rasmus, the TIMEOUT functionality of this function works fine under Linux -- however, it's not working under Win32 ! There apparently is another bug with this function -- you are suppose to be able to call more than one REGISTER_SHUTDOWN_FUNCTION(), and they are suppose to executed in-order... some people are reporting that only the first encountered REGISTER_SHUTDOWN_FUNCTION() is executed, then the script exits. Someone needs to go through this function, pretty thoroughly, and get it working correctly. Being able to run code on a timeout, user-abort or error is critical. Jason John Holmes [EMAIL PROTECTED] wrote in message 000401c25e43$7237e240$b402a8c0@mango">news:000401c25e43$7237e240$b402a8c0@mango... I'm not sure if that's a bug, it's more of a feature request. ---John Holmes... -Original Message- From: Jason Caldwell [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 17, 2002 3:24 AM To: [EMAIL PROTECTED] Subject: [PHP] REGISTER_SHUTDOWN_FUNCTION() BUG -- Please Fix. I'm posting this here to give this BUG attention. It's a pretty serious one for Win32 users, and it would be great if it could be fixed *very quickly* -- I posted this in the Bug Reports on PHP.net on May 27th, 2002. Here's the link: http://bugs.php.net/bug.php?id=17461 I need to use this function to perform certain *required* tasks on a Timeout -- however (and please read the Bug Report, before replying) the Timeout functionality of this function DOES NOT work on Win32 builds. If your a C/C++ / PHP contributor and have a moment to look into this -- it would be great -- I would love to see this fixed in release 4.2.4 !!! Thanks Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] register_shutdown_function
On Sunday, April 14, 2002, at 07:23 PM, Hayden Kirk wrote: im trying to make a distructor for a mysql class to kill the connection when the object is destroyed using register_shutdown_function(~xmysql); if i put that in my class will it do that or am i getting confused. ~xmysql is a destructor function i made. Heres the code, will it work how i want it to? I did not think that PHP had support for destructor methods. You could call your xmysql method manually if you like but you can't have it called automatically if your object is unset(). This is according to: http://www.php.net/manual/en/language.oop.constructor.php , down at the bottom just before the annotations. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] register_shutdown_function
On Tue, 26 Mar 2002, Jason Goodman wrote: 2 questions about register_shutdown_function. 1)Functions registered with register_shutdown_function are called after the script finishes processing. Is there a way to have a function only called when the PHP form is actually closed? 2)The function registered with register_shutdown_function does not seem to write to a file before the PHP page is closed. I need to send a message to another file when the PHP form is closed. When you say when the PHP form is closed do you mean when the user has finished looking at the page on their browser and moves on to something else by clicking their mouse? Because there's not particularly a way to do this. The connection between PHP script and browser is finished before anything even displays in the browser window (unless you're flushing the output buffer, but that doesn't help you any). You could attach some JavaScript to the page that looks for window closure and away-clickery and then sends your server a request for a PHP file in response, but that's outside the scope of this list (it's a JavaScript problem). miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] register_shutdown_function vs require (with pseudocode example)
Hi, No one has any idea on this topic? Or the question wasn't clear? Thanks, Arpi Hi again, I read my email back and found a little hard to understand :)), so I thought a code exmplae might help. It's just pseudo code for explaining how my cache works: //simplified main code if page is in cache { deliver the old one register_shutdown_function(regenerate) } else { regenerate() deliver } //registered shutdown function function regenerate() { if it's locked by another process { return } else { lock require_once(...); require_once(...); require_once(...); require_once(...); require_once(...); creation of many classes calling of many methods (the code is approx 1,6Megs) store unlock } } The main code delivers the page and reigsters the regenerate() function, and that's all what it should do. It takes about 0.04s, but this time unfortunately depends on what the regenerate() function does. If the page is locked then it finishes quickly (the overall time is 0.04s again), but when it can be regenerated it takes 0.25s. By the way the whole page regeneration takes 1.1s, that's why I really don't understand the 0.25s. I hope it was clearer with the two mails :)), and someone has an idea of whats happening here. Thanks for your help, Arpi -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] register_shutdown_function vs require (with pseudocode example)
Hi again, I read my email back and found a little hard to understand :)), so I thought a code exmplae might help. It's just pseudo code for explaining how my cache works: //simplified main code if page is in cache { deliver the old one register_shutdown_function(regenerate) } else { regenerate() deliver } //registered shutdown function function regenerate() { if it's locked by another process { return } else { lock require_once(...); require_once(...); require_once(...); require_once(...); require_once(...); creation of many classes calling of many methods (the code is approx 1,6Megs) store unlock } } The main code delivers the page and reigsters the regenerate() function, and that's all what it should do. It takes about 0.04s, but this time unfortunately depends on what the regenerate() function does. If the page is locked then it finishes quickly (the overall time is 0.04s again), but when it can be regenerated it takes 0.25s. By the way the whole page regeneration takes 1.1s, that's why I really don't understand the 0.25s. I hope it was clearer with the two mails :)), and someone has an idea of whats happening here. Thanks for your help, Arpi -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] register_shutdown_function - uses for
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
"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
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
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]
Re: [PHP] register_shutdown_function() not working ?
Hello Andrew, Sorry, but i forget what I have Zend Debuger :) Problem in file path, when i use absolute path /home/user/tmp/tmp/text.txt all works. It appears, that in shutdown_function getcwd () == '/', but in script getcwd () == '/home/user/public_html/' Only not clearly why. AS Hello php-general, AS Why this not working (php.4.0.4pl1_Linux)? AS ? AS error_reporting(E_ALL); AS $file_name = '../tmp/text.txt'; AS function funct1(){ ASglobal $file_name; ASif ($fd = fopen($file_name,'a+')){ AS fwrite($fd,"Funct1\n"); AS fclose($fd); AS}else{ AS die("Can not open output file"); AS} AS } AS function funct2(){ ASglobal $file_name; ASif ($fd = fopen($file_name,'a+')){ AS fwrite($fd,"Funct2\n"); AS fclose($fd); AS} AS } AS $i = register_shutdown_function('funct2'); AS funct1(); ? AS file have only "Funct1" ? AS Best regards, AS Andrew Sitnikov AS e-mail : [EMAIL PROTECTED] AS GSM: (+372) 56491109 Best regards, Andrew Sitnikov e-mail : [EMAIL PROTECTED] GSM: (+372) 56491109 -- 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]