Debugging php-cli scripts with xdebug and netbeans?

前端 未结 7 1125
闹比i
闹比i 2021-01-29 19:40

I have managed to initiate php-cli script debug session from the IDE itself, but I need to start the debugging session from the shell / command line. These are rather complex ma

7条回答
  •  轮回少年
    2021-01-29 20:19

    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) so 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.

    Note: If you want to debug remotely using netbeans you need to use Debug File on the file that is being run from the command line, not normal Debug.

提交回复
热议问题