I have a PHP script that is kicked off via ajax. This PHP script uses exec() to run a separate PHP script via the shell.
The script that is called via exec() may take 30 seconds or so to complete. I need to update the UI once it is finished.
Which of these options is preferred?
a) Leave the HTTP connection open for the 30 seconds and wait for it to finish.
b) Have exec() run the PHP script in the background and then use ajax polling to check for completion (every 5 seconds or so).
c) Something else that I haven't thought of.
Thank you, Brian