【发布时间】:2017-12-14 06:59:33
【问题描述】:
我一直在尝试使用“PHP Debug”扩展在 VSCode 上配置 xDebug,以与我当地的 Homestead 一起工作。不知何故,它根本不起作用。我一直在尝试不同的配置更改,但没有成功。
这是我在 Vagrant box 和 VSCode 中的配置:
/etc/php/7.1/fpm/conf.d/20-xdebug.ini
zend_extension=/usr/lib/php/20160303/xdebug.so
xdebug.remote_enable = 1
xdebug.remote_connect_back = 0
xdebug.remote_host = 192.168.0.104
xdebug.remote_port = 9000
xdebug.max_nesting_level = 512
xdebug.remote_handler = "dbgp"
xdebug.remote_log=/var/log/xdebug.log
这是我在 VSCode 中的配置:
launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"serverSourceRoot": "/home/vagrant/projects/Projectname",
"localSourceRoot": "${workspaceRoot}",
"port": 9000,
"log": true
}
]
}
当我在 VSCode 中启动调试会话时,我会在调试窗口中看到以下输出:
<- launchResponse
Response {
seq: 0,
type: 'response',
request_seq: 2,
command: 'launch',
success: true }
但是在运行我的应用程序时,它不会在我的任何断点处停止。
知道什么地方出了问题吗?我是否需要将 VM 的任何端口映射到 Homestead.yaml 中的主机?
【问题讨论】:
标签: visual-studio-code xdebug homestead