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

后端 未结 8 1469
太阳男子
太阳男子 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:25

    I got this working on Ubuntu/Netbeans by:

    • copying the xdebug config lines from the /etc/php5/apache2/php.ini file into /etc/php5/cli/php.ini
    • setting an environment variable with the name of the debug session (you can get this from the query string in the url of the page netbeans launches when you start debugging) the command is: export XDEBUG_CONFIG="idekey=netbeans-xdebug"

    Then it's simply a case of starting debugging in netbeans and doing "php myscript.php" at the command line.

提交回复
热议问题