"Leif K-Brooks" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I need a way to keep the script running on the server, but control to
> the user.  I'm doing some lengthy processes on the server, and it seems
> stupid to keep the user waiting pointlessly.  I'm trying to do something
> like:
> <?php
> if(array_key_exists('secondrun',$_GET)){
>     print "Processing complete!";
>     exit;
> }
> header("Location:
> http://{$_SERVER['HTTP_HOST']}{$_SERVER['PHP_SELF']}?secondrun=1");
> //Do long processing here
> ?>
> but it waits till the long processing is done, and then redirects.  Is
> there another way to do this?

As you are asking this question, i presume your processing does not return
anything that you would need on this page. Here is a simple solution for
linux/unix based systems.

You put your processing into a command line scirpt (passing it varibles that
u need with $argv ) and call the scirpt like this :

system("./yourscirpt.php &");  // & will cause the script to go in the
background, thus u will get control of your script immideately.

I dont know how one can put things in the background on a win machine, but
thats the idea.

HTH
gamin.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to