How to trigger XDebug profiler for a command line PHP script?(如何为命令行 PHP 脚本触发 XDebug 分析器?)
问题描述
XDebug 提供配置指令 xdebug.profiler_enable_trigger
允许通过传递 GET 或 POST 参数XDEBUG_PROFILE"来激活分析.通过 HTTP 调用脚本时.如果您不想分析所有脚本,而只想分析少数特殊情况而不总是更改 PHP 配置,这会很方便.
XDebug offers the configuration directive xdebug.profiler_enable_trigger
that allows to activate profiling by passing the GET or POST parameter "XDEBUG_PROFILE" when calling a script via HTTP. This is handy if you don't want profiling for ALL of your scripts but only for a few special cases without always changing your PHP configuration.
有没有办法为命令行 PHP 程序实现相同的行为?我试图将 XDEBUG_PROFILE
作为命令行参数传递,但没有奏效.
Is there a way to achieve the same behavior for command line PHP programs? I tried to pass the XDEBUG_PROFILE
as a command line argument but it didn't work.
总的来说,分析命令行 PHP 效果很好,但我希望具有与浏览器和 HTTP 服务器相同的每次调用灵活性.
In general, profiling command line PHP works well, but I'd like to have the same per-call-flexibility as with a browser and HTTP server.
推荐答案
您可以使用 -d
标志传递 INI 设置:php -d xdebug.profiler_enable=On script.php代码>.
You can pass INI settings with the -d
flag: php -d xdebug.profiler_enable=On script.php
.
这篇关于如何为命令行 PHP 脚本触发 XDebug 分析器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何为命令行 PHP 脚本触发 XDebug 分析器?


基础教程推荐
- 在 CakePHP 2.0 中使用 Html Helper 时未定义的变量 2021-01-01
- 使用 PDO 转义列名 2021-01-01
- 找不到类“AppHttpControllersDB",我也无法使用新模型 2022-01-01
- HTTP 与 FTP 上传 2021-01-01
- 如何在 Symfony 和 Doctrine 中实现多对多和一对多? 2022-01-01
- 在 yii2 中迁移时出现异常“找不到驱动程序" 2022-01-01
- PHP 守护进程/worker 环境 2022-01-01
- Doctrine 2 - 在多对多关系中记录更改 2022-01-01
- phpmyadmin 错误“#1062 - 密钥 1 的重复条目‘1’" 2022-01-01
- 如何在 XAMPP 上启用 mysqli? 2021-01-01