Server, let the user go!
I have a php script that is suppose to run in the background of the server on a very very long loop. The problem is that a user has to call the script for it to begin. Is there a way to cut the users connection to the script? In other words:
Otherwise the user has to push the stop button or wait until the timer runs out. Right now the header does nothing until the loop ends-- and the loop doesn't end before the user times out.
header("Location: ./page.php"); //CUT THE USER'S CONNECTION HERE!
Or perhaps there is a way to run the script in another way, such as via the system() function? (Again, though, it would need to be called through a php script and redirect the user rather then having them stick around until they time out.)
Someone must have an idea. Don't be shy :)
you can use a Crontab for running the script
Running PHP Scripts with Cron
Thanks for the reply! A few questions:
1) Can I run that from a php script?
2) If so, how can I get the cron to run once (as opposed to every so often)?
3) What would it return?
I need to actually run the php loop as opposed to a cron, but if I can run the cron once to start the loop-- asuming that it will not keep the user around until the script finishes-- that would be great.
I figured it out, and it seems to be working. Thanks!