xdebug / vscode-php-debug

PHP Debug Adapter for Visual Studio Code 🐞⛔
MIT License
771 stars 176 forks source link

Proxy settings seem not to work #858

Closed jnagler closed 1 year ago

jnagler commented 1 year ago

We had a static proxy setup so far using fixed PORT and IDEKEY mappings for every developer, e.g. (3005/vscjnagler) - launch.json was adjusted for parameter port only: { "name": "Listen for Xdebug", "type": "php", "request": "launch", "port": 9005 }

with starting the proxy to listen on 9003 for Xdebug (dbgpProxy assumes 9000 as default) and 9001 (the default) for clients and using the proxyinit command to register IDEKEY for PORT:

nohup dbgpProxy -s 127.0.0.1:9003 &
echo -e "proxyinit -p 9005 -k vscjnagler -m 1\0" | nc 127.0.0.1 9001

dbgpProxy says "Added connection for IDE Key 'vscjnagler': 127.0.0.1:9005" and vscode-php-debug says in the debug console "Listening to Xdebug on port 0.0.0.0:9005 ..." and the debugger runs to the first breakpoint.

I just saw the new feature to configure a proxy and therefore I assume this will take over the proxyinit. But adding the following to the configuration

            "proxy": {
                "enable": true,
                "host": "127.0.0.1",
                "port": 9001,
                "key": "vscjnagler"
            }

shows no effect. The proxy log is silent, no

16:28:12.379 [info] [server] Start new client connection from 127.0.0.1:55884
16:28:12.380 [info] [proxyinit] [vscjnagler] Added connection for IDE Key 'vscjnagler': 127.0.0.1:9005
16:28:12.380 [info] [server] Closing client connection from 127.0.0.1:55884

as with our manual proxyinit nor any other sign of vscode-php-debug is connecting it or interpreting the proxy section at all.

PHP version: 7.4.32 (RHEL 8.6, Remi's RPM repository) Xdebug version: 3.1.5 VS Code extension version: 1.29.0

Xdebug php.ini config: ; defaults except zend_extension=xdebug.so xdebug.log = /var/log/httpd/xdebug.log xdebug.mode = develop,debug,trace

Xdebug logfile (from setting xdebug.log in php.ini): empty

VS Code extension logfile (from setting "log": true in launch.json):

<- outputEvent
Gh {
  seq: 0,
  type: 'event',
  event: 'output',
  body: {
    category: 'stdout',
    output: 'Listening to Xdebug on port 127.0.0.1:9005 ...\n'
  }
}
Listening to Xdebug on port 127.0.0.1:9005 ...
<- launchResponse
Rh {
  seq: 0,
  type: 'response',
  request_seq: 2,
  command: 'launch',
  success: true
}
<- outputEvent
Gh {
  seq: 0,
  type: 'event',
  event: 'output',
  body: { category: 'stdout', output: '\n' }
}
zobo commented 1 year ago

Hi, the output seems a bit strange. The code of this extension does not have a string Listening to Xdebug on port. Can you check the version and ID of the installed extension. Click on the installed extension, it should be on the right.

jnagler commented 1 year ago

Sorry if I should have mixed-up things: More Info Published 29.12.2015, 17:55:50 Last released 9.10.2022, 08:52:39 Last updated 9.11.2022, 14:20:26 Identifier xdebug.php-debug

jnagler commented 1 year ago

image

at least clicking on Sponsor leads me to you https://github.com/sponsors/zobo and clicking on the extension name leads me to https://marketplace.visualstudio.com/items?itemName=xdebug.php-debug and from there I got here.

jnagler commented 1 year ago

I grep'ed through the extensions and found that the string "Listening to Xdebug" belongs to devsense.phptools-vscode. I was not aware both extensions provide the same functionality. Is it known on how to make your extension handle debugging instead of devsense php?

zobo commented 1 year ago

Ah, that makes sense. I'm not aware how to force the debug client in vscode to use a specific debug adapter. You can temporarily disable devsense?

jnagler commented 1 year ago

I can only temporarily disable devsense as there is a lot of other stuff I use from that extension. I will check whether I can switch off the debug adapter part or will try to find out how to organize priorities for multiple ones. Your port setting is all numeric (in contrast to devsense) and works well as well as the proxy setting. All as expected... at least a success for me after half a day of thinking I get mad.