RoadRunner
  • 🟠General
    • What is RoadRunner?
    • Features
    • Quick Start
    • Installation
    • Configuration
    • Contributing
    • Upgrade and Compatibility
  • 👷PHP Worker
    • Worker
    • Workers pool
    • Developer mode
    • Code Coverage
    • Debugging
    • Environment
    • Manual workers scaling
    • Auto workers scaling
    • RPC
  • 🟢Customization
    • Building RR with a custom plugin
    • Integrating with Golang Apps
    • Writing a Middleware
    • Writing a Jobs Driver
    • Writing a Plugin
    • Events Bus
  • 🔌Plugins
    • Intro into Plugins
    • Centrifuge (WebSockets)
    • Service (Systemd)
    • Configuration
    • Server
    • Locks
    • gRPC
    • TCP
  • 🌐Community Plugins
    • Intro into Community Plugins
    • Circuit Breaker
    • SendRemoteFile
    • RFC 7234 Cache
  • 🔵App Server
    • Production Usage
    • RoadRunner with NGINX
    • RR as AWS Lambda
    • Docker Images
    • CLI Commands
    • Systemd
  • 🔐Key-Value
    • Intro into KV
    • Memcached
    • In-Memory
    • BoltDB
    • Redis
  • 📦Queues and Jobs
    • Intro into Jobs
    • Google Pub/Sub
    • Beanstalk
    • In-Memory
    • RabbitMQ
    • BoltDB
    • Kafka
    • NATS
    • SQS
  • 🕸️HTTP
    • Intro into HTTP
    • Headers and CORS
    • Proxy IP parser
    • Static files
    • X-Sendfile
    • Streaming
    • gzip
  • 📈Logging and Observability
    • OpenTelemetry
    • HealthChecks
    • Access Logs
    • AppLogger
    • Metrics
    • Grafana
    • Logger
  • 🔀Workflow Engine
    • Temporal.io
    • Worker
  • 🧩Integrations
    • Migration from RRv1 to RRv2
    • Spiral Framework
    • Yii
    • Symfony
    • Laravel
    • ChubbyPHP
  • 🧪Experimental Features
    • List of the Experimental Features
  • 🚨Error codes
    • CRC validation failed
    • Allocate Timeout
  • 📚Releases
    • v2025.1.1
    • v2025.1.0
    • v2024.3.5
    • v2024.3.4
    • v2024.3.3
    • v2024.3.2
    • v2024.3.1
    • v2024.3.0
Powered by GitBook
On this page
  • PhpStorm notes
  • Jobs debugging
  • Prerequisites
  • Debug process

Was this helpful?

Edit on GitHub
  1. PHP Worker

Debugging

PreviousCode CoverageNextEnvironment

Last updated 1 year ago

Was this helpful?

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.

xdebug

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:

.rr.yaml
rpc:
   listen: tcp://127.0.0.1:6001

server:
   command: "php worker.php"
   env:
     - XDEBUG_SESSION: 1

http:
   address: "0.0.0.0:8080"
   pool:
      num_workers: 1
      debug: true

You should be able to use breakpoints and view state at this point.

PhpStorm notes

export PHP_IDE_CONFIG="serverName=octane-app.test"
export XDEBUG_SESSION="mode=debug start_with_request=yes client_host=127.0.0.1 client_port=9003 idekey=PHPSTORM"

php -dvariables_order=EGPCS artisan octane:start --max-requests=250 --server=roadrunner --port=8000 --rpc-port=6001 --watch --workers=1

Jobs debugging

Prerequisites

  1. XDebug 3 installed and properly configured.

  2. Number of jobs workers set to 1 with jobs.pool.num_workers configuration option in .rr.yaml.

Debug process

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:

./rr reset jobs

Now you should see debug session started:

  1. Step over to some place where job task is being resolved with $consumer->waitTask().

  2. As soon as you reach it, debugger stops but session will still be active.

  3. 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.

  4. 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.

Please, keep in mind this guide: .

Feel free to check our community notes:

👷
xdebug3
link