How do I start a PHP script to run in the background so my foreground process in a web browser doesn't freeze waiting for it to end.
Secnario:
User uploads a file
After saving the file, I kick off a background PHP script to process it
When the background script ends, it sends the user an email to notify them.
I've seen similar questions, but no answers or sample code to make these calls.
exec("whatever &");
( also possible system(), passthru(), shell_exec() ...)
or more elegant using pcntl_fork(), see http://php.net/manual/en/function.pcntl-fork.php
or probably simply using fork()
on windows ... have fun :-/ (example never tested):
pclose(popen("start whatever", "r"));