Revision: Thu, 18 Apr 2024 09:24:14 GMT
v2.14 – outdated
This version of the documentation is outdated. Consider upgrading your project to Spiral Framework 3.12
Edit this page

Debug and Profiling - XDebug

It is possible to debug the Spiral application like any other classic PHP applications using xDebug extension.

IDE Configuration

Read more about IDE configuration here.

On-Demand

Is it more convenient to start RoadRunner with xDebug enabled only when it's needed. Add the following env variables to .rr.yaml to properly configure xDebug:

yaml
env:
  PHP_IDE_CONFIG: serverName=application.loc
  XDEBUG_CONFIG: remote_host=localhost max_nesting_level=250 remote_enable=1 remote_connect_back=0 var_display_max_depth=5 idekey='PHPSTORM'

Note
Alter values according to your environment.

To enable xDebug run application server with -o (overwrite flag) for needed service:

./rr serve -o "server.command=php -d zend_extension=xdebug app.php"

In Docker

To alter workers config in docker use the following or similar config for your container:

yaml
event-service:
  build:
    dockerfile: Dockerfile
    context: .
  command:
    - /usr/local/bin/rr
    - serve
    - -o
    - server.command=php -d zend_extension=xdebug.so app.php
  environment:
    PHP_IDE_CONFIG: serverName=application.loc
    XDEBUG_CONFIG: remote_host=host.docker.internal max_nesting_level=250 remote_enable=1 remote_connect_back=0 var_display_max_depth=5 idekey='PHPSTORM'