如何触发XDebug探查器的命令行PHP脚本? [英] How to trigger XDebug profiler for a command line PHP script?

查看:461
本文介绍了如何触发XDebug探查器的命令行PHP脚本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

XDebug提供配置指令xdebug.profiler_enable_trigger,允许通过在通过HTTP调用脚本时传递GET或POST参数XDEBUG_PROFILE来激活概要分析。如果你不想要对所有脚本进行分析,而只是为了少数特殊情况而不改变你的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工作很好,但我想

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 = php

You can pass INI settings with the -d flag: php -d xdebug.profiler_enable=On script.php.

这篇关于如何触发XDebug探查器的命令行PHP脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆