How can a PHP script start another PHP script, and then exit, leaving the other script running?
Also, is there any way for the 2nd script to inform the PHP script when i
You can effectively achieve this by forking and then calling include
or require
.
parent.php:
sleeper.php:
Output:
$ php parent.php Sleeper started at 01:22:02 Parent waiting at 01:22:02 Sleeper done at 01:22:05 Parent done at 01:22:05
However, forking does not inherently allow any inter-process communication, so you'd have to find some other way to inform the parent that the child has reached the specific line, like you asked in the question.