I'm running PHP CLI and calling parent/child script by forking. The child scripts are running in background and are difficult to debug. They need to run in foreground. I was looking at the option of calling scripts using the exec command, but they run in background too. How can I run scripts called from a PHP script in foreground? My only other solution seems to be writing a shell script that calls the PHP program in a loop.
Another problem with this same script is finding out how to trap ctrl-c in PHP CLI. I have found numerous examples that work on the web, but not CLI.