Debugging PHP CLI scripts with Netbeans

CLI Netbeans PHP Xdebug

Today I share a little trick to debug PHP command line scripts with Netbeans. I expect for this trick to work that you have already set up Xdebug properly. If not, you need to follow these instructions. First we need to get the debugging Session ID of Netbeans, by default this will be netbeans-xdebug. xdebug-config Then it's just simply a case of starting debugging in netbeans and executing the following in the command line (This will set an environment variable with the name of the debug session):
export XDEBUG_CONFIG="idekey=netbeans-xdebug"
And last but not least execute your script from the command line
php myscript.php


comments powered by Disqus