【发布时间】:2020-07-23 09:36:53
【问题描述】:
我正在尝试使用 XDebug 和 Visual Studio Code 在 PHP 代码中设置断点,该代码全部安装在 Ubuntu Hyper-V 虚拟机上。我在 PHP 7.2 上。
每当我在我的 PHP 代码中设置断点并刷新应该命中断点的页面时,我都会在 Visual Studio Code 的弹出窗口中看到错误“命令不可用”和“没有这样的断点”。我还在调试控制台中收到以下错误。
XDebugError: command is not available
at new Response (/home/ben/.vscode/extensions/felixfbecker.php-debug-
1.13.0/out/xdebugConnection.js:56:19)
at new BreakpointSetResponse (/home/ben/.vscode/extensions/felixfbecker.php-debug-
1.13.0/out/xdebugConnection.js:207:9)
at Connection.<anonymous> (/home/ben/.vscode/extensions/felixfbecker.php-debug
1.13.0/out/xdebugConnection.js:599:20)
at Generator.next (<anonymous>)
at fulfilled (/home/ben/.vscode/extensions/felixfbecker.php-debug-1.13.0/out/xdebugConnection.js:4:58) {
code: 5,
name: 'XDebugError'
}
根据我的研究,我认为问题在于 XDebug 不适用于 IPv6,但调试器正在侦听 v6。如果我做netstat -an | grep 9000,我会得到
tcp6 0 0 :::9000 :::* LISTEN
这里是/etc/php/7.2/fpm/conf.d/20-xdebug.ini的内容
zend_extension=xdebug.so
xdebug.remote_autostart=1
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_host=127.0.0.1
xdebug.remote_mode=req
xdebug.remote_port=9000
xdebug.var_display_max_depth=-1
xdebug.var_display_max_children=-1
xdebug.var_display_max_data=-1
如何解决这个问题并让我的断点工作?
【问题讨论】:
-
我的笔记本电脑升级到 Ubuntu 20.04 后开始出现这个问题
-
你能解决这个问题吗?我也遇到了这个问题,这是工作中的障碍
-
我也有同样的问题
-
我也有同样的问题
标签: php visual-studio-code xdebug