我正在努力处理 WAMP 中的 xDebug 分析。它与浏览器完美配合,我得到了 cachegrind.out 文件,但如果我尝试使用命令行执行 php 脚本,我就不走运了。没有生成 cachegrind 文件。
这是我的 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
如 This SO question 中所述
我什至执行了 php --ini 来了解在 Windows 上是否有另一个不同于 Apache 使用的 php.ini 文件。事实证明这是同一个文件:
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 有问题添加基于环境变量的触发器。
关于php - XDebug 分析在 Windows 命令行中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19856940/