You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

VirtualBox Ubuntu PHP经sshfs挂载WSL后VSCode调试失败求助

PHP XDebug调试失败排查求助

我的环境配置:

  • Nginx运行在VirtualBox的Ubuntu系统(采用仅主机适配器,系统IP为192.168.56.2)
  • 项目根目录通过sshfs挂载到WSL/Ubuntu,挂载命令:
# 在WSL中执行
sshfs user@192.168.56.2:/nginx ~/mountpoint
  • 使用VSCode的WSL目标进行代码编辑,日常仅做JS开发,现在需要调试PHP代码

已完成的配置内容:

VirtualBox中Ubuntu的php.ini配置

[xdebug]
zend_extension = xdebug
xdebug.mode = debug
xdebug.start_with_request = yes
xdebug.client_host = 192.168.56.1
xdebug.client_port = 9003

VSCode的launch.json配置

{
    "name": "Listen for XDebug",
    "type": "php",
    "request": "launch",
    "port": 9003,
    "log": true,
    "pathMappings": {
        "/nginx": "${workspaceRoot}"
    }
}

VSCode调试日志输出:

Listening on { address: '::', family: 'IPv6', port: 9003 }
<- launchResponse
Response { seq: 0, type: 'response', request_seq: 2, command: 'launch', success: true }
<- initializedEvent
InitializedEvent { seq: 0, type: 'event', event: 'initialized' }
-> setFunctionBreakpointsRequest
{ command: 'setFunctionBreakpoints',
  arguments: { breakpoints: [] },
  type: 'request',
  seq: 3 }
<- setFunctionBreakpointsResponse
Response {
  seq: 0,
  type: 'response',
  request_seq: 3,
  command: 'setFunctionBreakpoints',
  success: true,
  body: { breakpoints: [] } }
-> setExceptionBreakpointsRequest
{ command: 'setExceptionBreakpoints',
  arguments: { filters: [] },
  type: 'request',
  seq: 4 }
<- setExceptionBreakpointsResponse
Response {
  seq: 0,
  type: 'response',
  request_seq: 4,
  command: 'setExceptionBreakpoints',
  success: true,
  body: { breakpoints: [] } }
-> configurationDoneRequest
{ command: 'configurationDone', type: 'request', seq: 5 }
<- configurationDoneResponse
Response {
  seq: 0,
  type: 'response',
  request_seq: 5,
  command: 'configurationDone',
  success: true }
-> threadsRequest
{ command: 'threads', type: 'request', seq: 6 }
<- threadsResponse
Response {
  seq: 0,
  type: 'response',
  request_seq: 6,
  command: 'threads',
  success: true,
  body: { threads: [] } }

目前调试完全无法触发,怀疑是网络设置存在问题,或是sshfs挂载方式不适合这类调试场景,求解决办法。

内容的提问来源于stack exchange,提问作者nanana

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.30 05:02:55