![](/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.