For a process that takes a long time, I usually break the user interaction
& the processing apart.

For instance, when the user makes a submission from the browser interface,
the PHP takes the submitted data and stores it someplace on the file
system or in a database.  This being a quick operation, the user can be
safely notified that their submission is complete, and the user can go
about his/her business within the browser interface.  Then there is a
process that runs on the server, say every minute (asynchronously from
visitors triggering the PHP script), that is looking for new data in the
location the PHP script deposits the submitted data, and processes it.

It's a bit more work than just making the PHP script execute for hours,
but it is far better use of the server's resources, and gives you much
more flexibility to alter the processing w/o affecting the user experience
(actually creating a better user experience).

        g.luck,
        ~Chris                           /"\
                                         \ /     September 11, 2001
                                          X      We Are All New Yorkers
                                         / \     rm -rf /bin/laden

On Fri, 19 Oct 2001 [EMAIL PROTECTED] wrote:

> Hi All-
>
> I have a script in which I use ignore_user_abort() to perform some
> extensive processing that
> can take a few hours which there is no need for users to wait for.
>
> I display a message saying their submission is complete and continue to run
> the PHP script
> in the background. It doesn't matter if they close their browser or
> whatever, as the script continues
> to run.
>
> My problem is, I want the browser to stop waiting for more output from the
> script. It confuses people
> when it says you may now close the browser when the icon in the top right
> is still moving and the progress
> bar is still moving.
>
> Is there any way in PHP (or even Javascript) that I can tell the browser to
> close the connection
> (ie. the equivalent of hitting the stop button).
>
> Apparently "window.stop()" in javascript works in Netscape Navigator but
> not in IE. I really need this to
> work in IE (and it only need be IE!).
>
> Any ideas?
>
> PS/ Not really keen on running a cron job to do the same thing when it
> would be easier just to stop
> the browser from loading.
>
> -Adam
>
>
> --
> 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]

Reply via email to