![](/img/trans.png)
[英]VSCode and PHP with XDebug and PHP Debug extension and IISExpress
[英]Debug PHP in CLI mode using Xdebug and PHP Debug extension
我无法从本地主机上的 CLI 设置调试(在 PHP 调试中启动当前打开的脚本配置)脚本运行,但忽略任何断点。 否则,在浏览器中调试 PHP 工作正常。
我的设置,launch.json:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9000
},
{
"name": "Launch currently open script",
"type": "php",
"request": "launch",
"program": "${file}",
"cwd": "${fileDirname}",
"externalConsole": false,
"port": 9000,
"stopOnEntry": true,
"hostname": "localhost",
"runtimeExecutable": "C:\\wamp64\\bin\\php\\php7.4.1\\php.exe",
"env": {"XDEBUG_CONFIG" : "remote_enable=1 remote_mode=req remote_port=9000 remote_host=127.0.0.1 remote_connect_back=0"
},
"runtimeArgs": ["-dxdebug.remote_enable=1", "-dxdebug.remote_mode=req", "-dxdebug.remote_port=9000", "-dxdebug.remote_host=127.0.0.1", "-dxdebug.remote_connect_back=0"
]
}
]
}
php.ini 中的 Xdebug 部分:
[xdebug]
zend_extension="c:/wamp64/bin/php/php7.4.1/zend_ext/php_xdebug-2.9.0-7.4-vc15-x86_64.dll"
xdebug.remote_enable = On
;xdebug.remote_autostart = 1
xdebug.profiler_enable = off
xdebug.profiler_enable_trigger = Off
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir ="c:/wamp64/tmp"
xdebug.show_local_vars=0
xdebug.remote_log = "c:/wamp64/tmp"
;xdebug.remote_host=localhost
正如您从设置中看到的那样,我尝试尝试不同的设置,但无济于事。
编辑:这是来自调试的日志文件:
<- launchResponse
Response {
seq: 0,
type: 'response',
request_seq: 2,
command: 'launch',
success: true
}
<- outputEvent
OutputEvent {
seq: 0,
type: 'event',
event: 'output',
body: { category: 'stdout', output: 'gotovo!' }
}
gotovo!
<- terminatedEvent
TerminatedEvent { seq: 0, type: 'event', event: 'terminated' }
-> disconnectRequest
{
command: 'disconnect',
arguments: { restart: false },
type: 'request',
seq: 3
}
您在终端 cli 上没有相同的可能性,因为您不使用 php 模块。 这里仅在服务器 apache 或 nginx 内部。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.