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 分析器?


- openssl_digest vs hash vs hash_hmac?盐与盐的区别HMAC? 2022-01-01
- 如何使用 Google API 在团队云端硬盘中创建文件夹? 2022-01-01
- PHP foreach() 与数组中的数组? 2022-01-01
- Laravel 5:Model.php 中的 MassAssignmentException 2021-01-01
- 使用 GD 和 libjpeg 支持编译 PHP 2022-01-01
- 覆盖 Magento 社区模块控制器的问题 2022-01-01
- Oracle 即时客户端 DYLD_LIBRARY_PATH 错误 2022-01-01
- PHP - if 语句中的倒序 2021-01-01
- 如何在 Symfony2 中正确使用 webSockets 2021-01-01
- 如何从数据库中获取数据以在 laravel 中查看页面? 2022-01-01