在 Visual Studio Code (1.9.1) (mac) 中我已经设置了php 调试插入。
在调试屏幕中我开始'监听 Xdebug'.
之后,我在我的 XAMPP 服务器(本地)上打开 index.php。
但什么也没发生。
- 屏幕底部的蓝色条变成橙色。
- 步过、步入和步出按钮呈灰色。
- 监视的变量也会出现以下错误消息:
无法在没有连接的情况下评估代码
我尝试在以下代码上使用断点:
<?php
$i = 0;
do {
$i++;
if (!($i % 1)) {
echo('<p>$i = ' . $i . '</p>');
}
}
while ($i < 100);
?>
我正在使用 XAMPP 并在我的php.ini文件我使用端口 9000 进行 Xdebug。
zend_extension="/usr/local/Cellar/php71-xdebug/2.5.0/xdebug.so"
xdebug.remote_enable = 1
xdebug.remote_autostart = 1
xdebug.remote.port=9000
我使用自制程序安装了 Xdebug。
这是我的 php 信息:phpinfo.htm http://trapce.net16.net/phpinfo.htm
X调试向导 https://xdebug.org/wizard.php告诉我 Xdebug 已正确安装。
my 启动.json文件看起来像这样:
{
"version": "0.2.0",
"configurations": [
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9000,
"log": true
},
{
"name": "Launch currently open script",
"type": "php",
"request": "launch",
"program": "${file}",
"cwd": "${fileDirname}",
"port": 9000
}
]
}
有人知道我做错了什么吗?
设置后xdebug.remote_connect_back = 1
在.ini文件中
正如 n00dl3 建议的那样,调试大部分时间都有效,但偶尔我会得到以下信息
调试控制台中出现错误:
<- threadEvent
ThreadEvent {
seq: 0,
type: 'event',
event: 'thread',
body: { reason: 'exited', threadId: 1 } }