使用 xdebug zend 将 Eclipse PHP 调试为“Web 应用程序”不会在断点处停止

问题描述 投票:0回答:1

我使用 apache 服务器并使用 Chrome 配置了 PHP Xdebug。它正在工作,但后来我使用其他配置,断点停止工作。

原来我的工作配置是这样的:

我的 php.ini:

[xdebug]
zend_extension="c:/wamp64/bin/php/php8.0.26/zend_ext/php_xdebug-3.2.2-8.0-vs16-x86_64.dll"
;xdebug.mode allowed are : off develop coverage debug gcstats profile trace
xdebug.mode =debug
xdebug.output_dir ="c:/wamp64/tmp"
xdebug.show_local_vars=0
xdebug.log="c:/wamp64/logs/xdebug2.log"
;xdebug.log_level : 0 Criticals, 1 Connection, 3 Warnings, 5 Communication, 7 Information, 10 Debug Breakpoint
xdebug.log_level=7
;VBE change: ;xdebug.profiler_output_name=trace.%H.%t.%p.cgrind
xdebug.profiler_output_name = "cachegrind.out.%t-%s"
xdebug.use_compression=false
xdebug.client_port = 9002
xdebug.client_host = localhost

窗口->首选项->PHP->服务器->默认 PHP Web 服务器

服务器选项卡:

调试器选项卡:

窗口->首选项->PHP->调试

窗口->首选项->PHP->调试->调试器->XDebug

然后我单击“运行”->“调试为”->“PHP Web 应用程序”

然后它提供“启动 URL”对话框。我不得不改变路径从

http://localhost/wp_leo/1/vbe_get_mem.php


http://localhost/3/1/vbe_get_mem.php

因为 Eclipse 使用的项目名称是

wp_leo
,但我在服务器上的实际路径只是
3

然后第一次断点起作用了。但后来我尝试了配置,并在某个时候断点停止工作。我在窗口->首选项->PHP->调试中检查时只得到“在第一行中断”。但所有其他断点都被忽略。所以问题是为什么我的断点被忽略了?????????

php eclipse debugging xdebug
1个回答
0
投票

因此,在一些 Eclipse 疯狂点击之后,我转到了 xdebug.log 文件。搜索

breakpoint
,我很幸运有命令
breakpoint_set
。所以我发现:

[22360] [Step Debug] <- breakpoint_set -i 897 -t line -f file:///http://localhost/3/1/vbe_get_mem.php -n 18
[22360] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="897" id="223600006"></response>

路径

/http://localhost/3/1/vbe_get_mem.php -n 18
实际上是正确的路径。但这不起作用。我想知道也许
file:///
http://
是奇怪的组合。所以我在 CLI 模式下尝试了我的调试器,其中断点有效并且使用了路径:

[20048] [Step Debug] <- breakpoint_set -i 967 -t line -f file:///C:%5Cwww%5C3%5C1%5Cvbe_get_mem.php -n 18

这看起来很狂野,但很有效。所以用

%5C
代替
/
。我的文档根目录是
c:/www/
,服务器上的路径是
3/1/vbe_get_mem.php

实际上我试图配置的一件事是映射路径。因为我不喜欢我调试的每个新文件都使用项目名称而不是服务器上的实际路径提供错误的路径,所以我需要手动重写它......所以我玩了 Window->Preferences->PHP->Servers->默认 PHP Web 服务器 -> 选项卡“路径映射”。也许那是错误的。解决方案是删除那里的所有内容并将其清空。像这样:

然后断点开始工作。 xdebug.log 中的路径开始看起来与 CLI 模式下相同:

[16188] [Step Debug] <- breakpoint_set -i 1972 -t line -f file:///C:%5Cwww%5C3%5C1%5Cvbe_get_mem.php -n 9

祝你好运...

© www.soinside.com 2019 - 2024. All rights reserved.