How to trigger XDebug profiler for a command line PHP script?

后端 未结 8 1487
太阳男子
太阳男子 2020-12-04 04:48

XDebug offers the configuration directive \"xdebug.profiler_enable_trigger\" that allows to activate profiling by passing the GET or POST parameter \"XDEBUG_PROFILE\" when c

8条回答
  •  无人及你
    2020-12-04 05:28

    As described on the Xdebug Remote Debugging page, profiling can also be enabled via the XDEBUG_CONFIG environment variable by inluding a "profile_enable=1" directive:

    XDEBUG_CONFIG="profiler_enable=1" php ...
    

    For ease of use, the above command line can be written as an alias:

    alias xphp='XDEBUG_CONFIG="profiler_enable=1" php'
    

    The alias can be added to one of your shell's (interactive) startup scripts, such as ~/.bash_aliases or ~/.bashrc (as appropriate to your system).

提交回复
热议问题