Using XDebug with a PHP CLI Script That Forks Children

Submitted by kentr on Fri, 10/23/2015 - 15:02


Stepping through a PHP CLI script that forks processes (with pcntl_fork()) causes Eclipse debugger to hang (beachball).


Xdebug config:

xdebug.remote_enable = 1

; IP of the machine where the debug client is running, 
; such as the vagrant host machine.

xdebug.remote_autostart = 1
; "jit" = connect to client only on errors and xdebug_break().
xdebug.remote_mode = jit
xdebug.show_local_vars = 1

Eclipse config:

Preferences -> PHP -> Debug -> Installed Debuggers -> XDebug:

Accept remote session (JIT) = Prompt