NetBeans IDE supports the XDebug third-party PHP debugger. If Xdebug is installed correctly and the PHP environment is configured correctly, you can debug PHP projects inside the IDE. You can also debug PHP files remotely if you set up path mapping.
Additional information can be found in the following wiki document.
.The first step you should take is to see if XDebug is already installed on your system. Some AMP packages come with XDebug. Run phpinfo(). If there is an XDebug section in your PHP info, XDebug is installed. If XDebug is installed, go to Setting Up XDebug
The NetBeans IDE for PHP community consensus is that the XDebug installation wizard should be used to install XDebug.
In this section we assume you have XDebug installed and you need to set it up.
zend_extension=[path to xdebug .so or .dll] xdebug.remote_enable=1 xdebug.remote_handler=dbgp xdebug.remote_mode=req xdebug.remote_host=127.0.0.1 xdebug.remote_port=9000
Before trying out XDebug from inside NetBeans IDE, you should test your XDebug installation from the command-line. One way to test XDebug is to write a test in PHP and run a debug session on it.
<?php $address = '127.0.0.1'; $port = '9000'; $sock = socket_create(AF_INET, SOCK_STREAM, 0); socket_bind($sock, $address, $port) or die(); socket_listen($sock); $client = socket_accept($sock); echo "Connection established: $client"; socket_close($client); socket_close($sock); ?>
If XDebug is properly configured, the script started in step 3 should print a message like "Connection established: Resource id #5". If no message is printed and the script is still running, xdebug is not properly configured or uses a different port or has another problem. In this case, kill the running process and investigate where the problem is.
After you install, configure, and successfully test XDebug, you can set up XDebug options in the IDE. To learn more about these options, open Tools > Options (NetBeans Preferences on Mac), go to the PHP Options, open the Debugging tab, and click Help.
For more information about XDebug, see the following documents.
(NetBeans wiki page)