[FX.php List] After the Submit

Leo R. Lundgren leo at finalresort.org
Thu Sep 25 07:30:46 MDT 2008


The server and client communicating via HTTP is quite a basic thing,  
so there isn't much support for these kind of things by default. When  
your browser sends it requests you have time to cancel that before  
the request to the server completes, but that's not your scenario. In  
order to cancel a long-running script on the server you would need  
some form of application server that maintains state and where you  
have code that can affect other threads/requests that are currently  
processing, assuming your application is more than just a simple PHP  
page which is quite procedural. So in short, I believe (correct me if  
I'm wrong :) that you need something quite different from a PHP page.

I haven't tried if myself, but the thought of having your script  
records its state somewhere, in a file or a database, and then have  
the possibility to (from the browser) ask another script running as  
the same user on the server to send a termination signal (this would  
be in the operating system) to the running process, might work? This  
would probably require something else than an Apache server with  
mod_php, for example PHP running via FCGI and without restrictions in  
what it can do using system calls. Well, I don't know how feasable  
this is, and I doubt it's of interest in any case; It would just be a  
bad workaround for something that needs redesign.

Regarding when you edited your script; You didn't notice any change  
in the running script since it had already been loaded and parsed by  
the PHP engine. Only subsequent requests would load the new/edited  
script.

That's my take on it. I'm eager to hear if anyone know of a solution  
that I don't know of? :)


25 sep 2008 kl. 15.19 skrev Jonathan Schwartz:

> Hi Folks,
>
> Another one of those nagging questions...
>
> What server control is available from browser after hitting the  
> submit button, if any? Is there any way to Cancel an executing script?
>
> Say we have a script that runs long by design such as an emailing  
> routine.  Or, a script that is supposed to run fast, but is hanging.
>
> The browser has an "X" button (Safari), but I'm confident that that  
> just tells the browser to stop the download of the current page.   
> It doesn't tell the server to do the same, does it?
>
> On one misbehaving script, I had time to go in edit the looping  
> script (while it was executing) and added an exit in the loop. It  
> didn't seem to work.
>
> This is probably more applicable during development than production.
> Just asking.
>
> Jonathan
> -- 
> Jonathan Schwartz
> Exit 445 Group
> jonathan at exit445.com
> http://www.exit445.com
> 415-370-5011
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list


-|



More information about the FX.php_List mailing list