XDebug 分析在 Windows 命令行中不起作用


XDebug profiling not working in windows command line

我在WAMP中苦苦挣扎xDebug分析。它与浏览器完美配合,我正在获得 cachegrind.out 文件,但如果我尝试使用命令行执行 php 脚本,那就没有运气了。未生成任何缓存研磨文件。

这是我的php.ini文件:

[xdebug]
xdebug.remote_enable = On
xdebug.profiler_enable = 1
xdebug.profiler_enable_trigger = 1
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir = "c:/wamp/tmp/profiler"

我也尝试过profiler_enable_trigger = 0。还尝试添加参数:

php -d xdebug.profiler_enable=On script.php

php -dxdebug.profiler_enable=On script.php

就像这个SO问题中所述

我甚至执行了php --ini,以了解Windows上是否有另一个php.ini文件与Apache使用的文件不同。事实证明,这是同一个文件:

Configuration File (php.ini) Path: C:'windows
Loaded Configuration File:         C:'wamp'bin'php'php5.4.12'php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed:      (none)

由于它是相同的php.ini,所以我没有想法了。你能帮我吗?如果您需要任何其他输出,请不要犹豫。

如果打开xdebug.profiler_enable_trigger,则需要设置 cookie 来触发探查器。由于您无法在命令行上设置 cookie,因此这不起作用。对于命令行分析,您需要具有:

xdebug.profiler_enable = 1
xdebug.profiler_enable_trigger = 0

http://bugs.xdebug.org/view.php?id=1005 添加基于环境变量的触发器也存在问题。