php - Xdebug 连接在 XAMPP 中被重置
问题描述
我试图让 Xdebug 在 Windows 上的 VSCode 中运行。我刚刚在它自己的目录中安装了 Magento 2 框架xampp/htdocs/magento
。
Xdebug 在/dashboard
目录中运行良好,仅此而已。如果我尝试在任何其他目录中侦听 Xdebug,则不会命中断点,并且浏览器将显示以下错误:
'无法访问此站点。连接已重置。
我一直在寻找解决方案很多小时,但我无法让它工作。
这是 VSCode 的相关launch.json配置:
"version": "0.2.0",
"configurations": [
{
"name": "Listen for Xdebug",
"type": "php",
"request": "launch",
"port": 9003,
"runtimeExecutable": "c:\\xampp\\php\\php.exe"
}
这是相关的php.ini配置:
xdebug.mode = debug
xdebug.start_with_request = yes
zend_extension = "C:\xampp\php\ext\php_xdebug.dll"
xdebug.client_host=localhost
xdebug.idekey = VSCODE
xdebug.log="C:\xampp\php\ext\xdebug.log"
Xdebug 日志显示没有错误,这是最新的条目:
[14196] Log opened at 2021-10-14 12:35:22.508436
[14196] [Step Debug] INFO: Connecting to configured address/port: localhost:9003.
[14196] [Step Debug] INFO: Connected to debugging client: localhost:9003 (through xdebug.client_host/xdebug.client_port). :-)
[14196] [Step Debug] -> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" fileuri="file:///C:/xampp/htdocs/magento/index.php" language="PHP" xdebug:language_version="7.3.31" protocol_version="1.0" appid="14196" idekey="VSCODE"><engine version="3.1.0"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[https://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2021 by Derick Rethans]]></copyright></init>
[14196] [Step Debug] <- feature_set -i 1 -n resolved_breakpoints -v 1
[14196] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="1" feature="resolved_breakpoints" success="1"></response>
[14196] [Step Debug] <- feature_set -i 2 -n notify_ok -v 1
[14196] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="2" feature="notify_ok" success="1"></response>
[14196] [Step Debug] <- feature_set -i 3 -n extended_properties -v 1
[14196] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="3" feature="extended_properties" success="1"></response>
[14196] [Step Debug] <- breakpoint_set -i 4 -t line -f file:///c:/xampp/htdocs/magento/app/code/Iksula/Appapi/Model/Home/Home.php -n 450
[14196] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="4" id="141960001" resolved="unresolved"></response>
[14196] [Step Debug] <- breakpoint_set -i 5 -t line -f file:///c:/xampp/htdocs/dashboard/index.php -n 3
[14196] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="5" id="141960002" resolved="unresolved"></response>
[14196] [Step Debug] <- run -i 6
同样在/apache/logs/error.log
没有什么我能发现错误的地方
[Thu Oct 14 14:35:22.145361 2021] [core:notice] [pid 32252:tid 600] AH00094: Command line: 'c:\\xampp\\apache\\bin\\httpd.exe -d C:/xampp/apache'
[Thu Oct 14 14:35:22.147277 2021] [mpm_winnt:notice] [pid 32252:tid 600] AH00418: Parent: Created child process 31772
[Thu Oct 14 14:35:22.501540 2021] [mpm_winnt:notice] [pid 31772:tid 656] AH00354: Child: Starting 150 worker threads.
[Thu Oct 14 14:35:23.239695 2021] [mpm_winnt:notice] [pid 32252:tid 600] AH00428: Parent: child process 31772 exited with status 3221225477 -- Restarting.
[Thu Oct 14 14:35:23.309464 2021] [mpm_winnt:notice] [pid 32252:tid 600] AH00455: Apache/2.4.51 (Win64) OpenSSL/1.1.1l PHP/7.3.31 configured -- resuming normal operations
[Thu Oct 14 14:35:23.309464 2021] [mpm_winnt:notice] [pid 32252:tid 600] AH00456: Apache Lounge VC15 Server built: Oct 8 2021 10:03:59
[Thu Oct 14 14:35:23.309464 2021] [core:notice] [pid 32252:tid 600] AH00094: Command line: 'c:\\xampp\\apache\\bin\\httpd.exe -d C:/xampp/apache'
[Thu Oct 14 14:35:23.312450 2021] [mpm_winnt:notice] [pid 32252:tid 600] AH00418: Parent: Created child process 29828
[Thu Oct 14 14:35:23.682622 2021] [mpm_winnt:notice] [pid 29828:tid 660] AH00354: Child: Starting 150 worker threads.
配置不太可能有任何问题,因为我的断点确实被命中/dashboard/index.php
并且页面会相应地加载,但是如果我这样做/magento/index.php
,页面甚至不会加载。
有什么我想念的吗?
解决方案
推荐阅读
- c++ - 为什么 C++ 'int arr[n];' 这样 n 是变量在一种环境中工作而在另一种环境中不起作用?
- python - 将行数据从一个数据框排列到另一个数据框
- windows-store-apps - 修复了通过 Microsoft Store 安装 Windows 混合现实门户导致“出错”错误
- android - 为什么在运行时在 pubspec.yaml 中添加 firebase_admob: ^0.11.0+1 会产生错误(Flutter,Android)
- django - Django Rest Framework 如何过滤嵌套数据?
- java - Micronaut 需要异步编程吗?
- python - Python imshow 未显示更改
- apache-kafka - 在 docker 上为 kafka 暴露端口 8083 会出错
- maven - 有没有办法修复 Ambari Web 2.7.1.0.0 构建问题?
- php - Ajax表单提交我想通过id更改表单元素的值,以便脚本从php中的返回值进行下一次调用