VSCode で PHP の xdebug を使うときの listen するアドレス(が ipv6 だったとき)

VSCode で PHP の xdebug を使うときに、接続がうまくできなかった。

listen するアドレスを見たところ、v6 の方を listen しているようだった。…両方 listen してほしいが…。

lsof -nP -i4TCP:9003
lsof -nP -i6TCP:9003

XDebug fails to connect because vscode-php-debug is listening on IPv6
https://github.com/xdebug/vscode-php-debug/issues/288
Add hostname option to set the interface to bind to
https://github.com/xdebug/vscode-php-debug/pull/330/files
このような議論があり、hostname を指定すれば良いことが分かった。

  "configurations": [
    {
      "name": "Listen for Xdebug",
      "type": "php",
      "request": "launch",
      "hostname": "0.0.0.0",
      "port": 9003
    },

こんな感じ。

docker,php,wsl

Posted by tako