Trigger Xdebug with cookie XDEBUG_SESSION #1665
-
I've used to trigger debugging on demand, using I was unable to activate debugging with a cookie, cookie just seemed to be ignored. I thought it is Octane, who probably filters, blocks or clears request cookies, but I've started RoadRunner directly with So the question is, is it possible to make RoadRunner pass control to Xdebug extension on each request processing, not only on worker startup? Or, maybe there is some easy place in RoadRunner's code where I could add such call for extensions (Xdebug) and make a build of RoadRunner with this feature for myself. Alternatively, could you please suggest some other way to trigger Xdebug on RoadRunner for specific requests using cookie? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 5 replies
-
Hey @andrei-piarainc 👋🏻 |
Beta Was this translation helpful? Give feedback.
-
Hi @rustatian Version:
.rr.yaml:
Also some values got overwritten by command in
In Sail
In .env:
|
Beta Was this translation helpful? Give feedback.
-
This is not really about conditional breakpoints feature, it's about activating/deactivating the whole debug session. Xdebug is PHP extension, as far as I know it gets registered in PHP-engine as Zend extension and as a regular PHP extension (module) as well. Being registered as Zend extension makes PHP engine to call some extension's methods ("hooks") in appropriate moments. E.g. PHP-engine gives control to extension (calls it) during loading of new application script. And during this call Xdebug checks for env variable When I enable Xdebug log in
I get following results. For built-in PHP server:
First record appeared after application start (Xdebug extension was called by PHP-engine on script load). Consequent records appeared after each request I've sent to server (actually just refreshing the page in browser). I've not set For RoadRunner:
Here we can see only three records, Xdebug was called by PHP-engine on loading of each As a bottom line, it starts looking more like feature-request for RoadRunner, if I do not miss something in configuration of course ;) It would be nice if RR called extensions (registered in PHP-engine) on each new request, like built-in PHP server does. And that way become more like drop-in replacement for it. I'm not sure if there is a demand for that, probably only debuggers and profilers may need it. Talking about Xdebug, this feature will allow not only activate debug session for particular requests, but also activate/deactivate profiling and function tracing, depending on cookie value. Like described here: Better explanation of PHP extensions is here: |
Beta Was this translation helpful? Give feedback.
Nice, thanks for the detailed description @andrei-piarainc 👍🏻
Currently it is not possible to call some PHP internal things from Golang. I don't like the idea of integrating
CGO
into the RR engine, as this would require significant effort to support all platforms supported by RR.However, I know about the
php-src
internals and am working on a SAPI-RR integration, but in Rust, which is a lower level language compared to Golang. This will allow us to create a bridge to the PHP engine and call any methods we want 😃