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

标签 php windows command-line xdebug xdebug-profiler

我正在努力处理 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/

相关文章:

PHP SimpleXML->addChild - 不需要的空命名空间属性

php - 根据数据库验证用户并重定向到另一个 html 页面的问题

.net - 什么操作系统内置了 .NET 2 版本?

windows - Windows 上的 MonoDevelop

php - 如何在一系列链式选择框中填充 sql 查询结果?

php - 使用 Zerofill 匹配数据戳多个变体,无需等

windows - 如何获取应用程序的 Windows 任务栏按钮以显示进度条的进度

windows - 在批处理文件中隐藏逻辑结构,但显示实际执行的命令

linux - 用户名中的 pkill 通配符

c - ncurses 屏幕上的多种颜色