Eclipse PHP调试作为“CLI应用程序”不会在断点或第一行停止(使用zend xdebug)

Eclipse PHP debugging as "CLI application" does not stop at breakpoints nor first line (using zend xdebug)

提问人:Vit Bernatik 提问时间:8/25/2023 最后编辑:Vit Bernatik 更新时间:8/27/2023 访问量:43

问:

您好,我正在使用 Eclipse 2023-06 (4.28.0)

我使用了从 WAMP64 c:\wamp64\bin\php\php8.0.26\ 复制到 c:\Prog\php8.0.26\ 的 PHP

我在eclipse中配置:Window->Preferences->PHP->Installed PHP->Add

enter image description here

在调试选项卡上进行了预配置:

enter image description here

在我的 c:\Prog\php8.0.26\php.ini 中,我设置了 xdebug.mode=debug 和 xdebug.log_level=10

[xdebug]
zend_extension="c:/wamp64/bin/php/php8.0.26/zend_ext/php_xdebug-3.1.6-8.0-vs16-x86_64.dll"
;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/xdebug.log"
;xdebug.log_level : 0 Criticals, 1 Connection, 3 Warnings, 5 Communication, 7 Information, 10 Debug Breakpoint
xdebug.log_level=7
xdebug.profiler_output_name=trace.%H.%t.%p.cgrind
xdebug.use_compression=false

然后我将Run->Debug(as)->选定的“PHP CLI应用程序”设置为

PHP 被执行并打印了 echo,但没有命中断点。在右下角,它写着午餐并冷冻在 45%。

如何使调试器工作并在断点处停止?

php eclipse 调试 xdebug

评论


答:

1赞 Vit Bernatik 8/25/2023 #1

所以我在尝试了什么之后......我调查了一下: c:/wamp64/logs/xdebug.log

并发现:

[20988] Log opened at 2023-08-25 12:31:47.962528
[20988] [Step Debug] DEBUG: Found 'XDEBUG_CONFIG' ENV variable
[20988] [Step Debug] INFO: Connecting to configured address/port: localhost:9003.
[20988] [Step Debug] ERR: Time-out connecting to debugging client, waited: 200 ms. Tried: localhost:9003 (through xdebug.client_host/xdebug.client_port) :-(
[20988] Log closed at 2023-08-25 12:31:48.385527
enter code here

显然,默认的eclipse端口不适合默认的zend xdebug端口...伟大。。。

无论如何,现在的解决方案是更改端口。 要么在日食中填充 9003。 或者在您的 php.ini 设置:

xdebug.client_port = 9000

对我有用...