I have a CLI script written in PHP that I am trying to debug with XDebug. The debugger is working, as I can step through the code as it initializes, but it breaks down after the process forks, becomes a daemon, and lets the original process exit. My theory is the XDebug socket is closing when the initial process terminates, which leaves the daemon and any processes it forks without an open socket to my XDebug listener.
Database connections can be reconnected or even created after the fork, but XDebug appears to have no such option in their function list. Can the XDebug socket survive the initial process exiting or be reestablished after the a call to pcntl_fork()? Is there any workaround for this?
pcntl_fork().