【发布时间】:2017-12-26 16:08:49
【问题描述】:
我正在使用 Visual Studio 代码:
我还安装了 PHP 调试扩展版本 1.12.1。我的 PHP 版本是:
>php --version
PHP 7.1.8 (cli) (built: Aug 1 2017 21:10:46) ( ZTS MSVC14 (Visual C++ 2015) x86 )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
with Xdebug v2.5.5, Copyright (c) 2002-2017, by Derick Rethans
我已经按照PHP Debug 插件上的说明配置了 xdebug。
php.ini 中的设置如下所示:
zend_extension = "C:\xampp\php\ext\php_xdebug-2.5.5-7.1-vc14.dll"
[XDebug]
xdebug.remote_enable = 1
xdebug.remote_autostart = 1
xdebug.remote_connect_back = 1
xdebug.idekey = "whatever"
在运行phpinfo(); 时,我的 xdebug 显示正确:
我的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}",
"port": 9000
}
]
}
但是,在运行配置时,我得到:
错误日志如下所示:
messageService.ts:126 Debug adapter process has terminated unexpectedly
e.doShow @ messageService.ts:126
e.show @ messageService.ts:105
_.onServerExit @ rawDebugSession.ts:535
(anonymous) @ rawDebugSession.ts:449
emitTwo @ events.js:111
emit @ events.js:194
__dirname.ChildProcess._handle.onexit @ internal/child_process.js:215
有什么建议可以调试吗?
感谢您的回复!
【问题讨论】:
-
你的 xdebug.ini 设置是什么?
-
@Farkie Thx 为您解答!我没有
xdebug.ini文件。但是,我使用php.ini文件中的xdebug设置更新了我的答案。
标签: php visual-studio-code xdebug