Debugging
Last updated
Last updated
You can use RoadRunner scripts with xDebug extension. In order to enable configure your IDE to accept remote connections.
If you run multiple PHP processes you have to extend the maximum number of allowed connections to the number of active workers, otherwise some calls would not be caught on your breakpoints.
To activate xDebug make sure to set the xdebug.mode=debug
in your php.ini
.
To enable xDebug in your application make sure to set ENV variable XDEBUG_SESSION
:
Please, keep in mind this guide: xdebug3.
You should be able to use breakpoints and view state at this point.
Feel free to check our community notes: link
XDebug 3 installed and properly configured.
Number of jobs workers set to 1
with jobs.pool.num_workers
configuration option in .rr.yaml
.
If you have any active XDebug listener while starting RoadRunner with XDebug enabled β disable it. This will prevent false-positive debug session.
Once RoadRunner starts all workers, enable XDebug listener and reset jobs workers with:
Now you should see debug session started:
Step over to some place where job task is being resolved with $consumer->waitTask()
.
As soon as you reach it, debugger stops but session will still be active.
Trigger task consumption with either an HTTP request or a console command (depending on how your application works). and continue to debug job worker as usual within active session started before.
You can continue to debug jobs as long as debug session active.
If connections session broken or timed out, you can repeat instruction above to reestablish connection by resetting jobs workers.