XDebug breakpoint and worker mode #2163
-
|
Hi there, Sorry if it's a silly question. I've been trying to use a debug session with my IDE and frankenphp running in worker mode. The only way I got it working was to use the function Thanks ! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
|
Xdebug not working in worker mode is a known issue. I didn't find the time to investigate it, but it's on my todo list. Any help welcome! |
Beta Was this translation helpful? Give feedback.
-
|
Ok thanks, actually I got it working but it requires a manual |
Beta Was this translation helpful? Give feedback.
-
|
I can debug with xdebug in worker mode just fine. Settings: 15-xdebug.ini [xdebug]
zend_extension=xdebug-zts-85
xdebug.mode=debug
xdebug.start_with_request=trigger
xdebug.client_host=localhost
xdebug.client_port=9003
xdebug.ide_key="phpstorm"Caddyfile: {$SERVER_NAME:http://} {
root ./public
log
encode zstd br gzip
php_server {
root ./public
worker index.php 1
}
}Runner (SymfonyRuntime 8.0): $handler = function () use ($server, &$sfRequest, &$sfResponse): void {
// Connect to the Xdebug client if it's available
if (\extension_loaded('xdebug') && \function_exists('xdebug_connect_to_client')) {
xdebug_connect_to_client();
}
// Merge the environment variables coming from DotEnv with the ones tied to the current request
$_SERVER += $server;
$sfRequest = Request::createFromGlobals();
$sfResponse = $this->kernel->handle($sfRequest);
$sfResponse->send();
};
$loops = 0;
do {
$ret = frankenphp_handle_request($handler);
if ($this->kernel instanceof TerminableInterface && $sfRequest && $sfResponse) {
$this->kernel->terminate($sfRequest, $sfResponse);
}
gc_collect_cycles();
} while ($ret && (0 >= $this->loopMax || ++$loops < $this->loopMax));php -v: ❯❯ symfony-demo git:(main) 21:27 php-zts -v
PHP 8.5.2 (cli) (built: Jan 16 2026 01:36:34) (ZTS zig 0.15.2 x86_64)
Copyright (c) The PHP Group
Built by Static PHP <https://static-php.dev> #StandWithUkraine
Zend Engine v4.5.2, Copyright (c) Zend Technologies
with Xdebug v3.5.1, Copyright (c) 2002-2026, by Derick Rethans
with Zend OPcache v8.5.2, Copyright (c), by Zend Technologies |
Beta Was this translation helpful? Give feedback.
I can debug with xdebug in worker mode just fine.
Settings:
15-xdebug.ini
Caddyfile:
{$SERVER_NAME:http://} { root ./public log encode zstd br gzip php_server { root ./public worker index.php 1 } }Runner (SymfonyRuntime 8.0):