Note that this is optional. Our projects are simple enough to be debugged by echo and error_log additions to code. Note that echo alone is not sufficient, because sometimes the error prevents the page from displaying at all, so the echo output is lost. So be sure to try out error_log.
To use the debugger, you need to edit your php.ini in xampp/php. This is explained in the appendixes of second-edition M&H, but they assume that there lines about xdebug already in the file, but more recent XAMPP installations have nothing about xdebug. Hopefully the third edition is right. But you need help finding the right version of DLL to use, so read on.
You
need to download the xdebug DLL from www.xdebug.org, choosing the right
.dll (.so for Mac or Linux) for your version of PHP. Run the
wizard at https://xdebug.org/wizard.php
and download the file it suggests.
The lines you need to add to php.ini for Windows are
zend_extension=c:\xampp\php\ext\php_xdebugxxxx.dll
(where xxxx stands for version information)
xdebug.remote_enable=1
(the wizard doesn't mention this, but the book's appendix does, and it
is needed)
After this edit, restart Apache, and
restart the debugger in Netbeans if it was running. These instructions
have been tested by me on Windows 7 and 10.
Murach's coverage of the Mac case is complicated, so obtain a copy of that page if you want to use the debugger. His coverage of Linux is incomplete, and involves C compilation. But I believe the wizard handles the Mac too, so try it and let me know what happens.
Use Project Properties to set the Browser to Chrome, or set the Netbeans
default browser to Chrome once and for all using
Tools>Options>General WebBrowser.
Start the debugger by clicking the project and selecting Debug, or using an icon at the top. It is best to do this (at least at first) with the browser down, so this action will attempt to bring it up to display the page. However, because the debugger stops at the start of each page (unless you change the default settings), it will not actually display the page yet. Instead you need to work with the debugger to get something to happen.
You may think that nothing is happening at the start, because nothing shows in the browser window. You need to select the Netbeans window and use the down arrow icon to move the cursor through the PHP code, or use the continue button. You won't see anything in the browser window until the PHP code sends the response HTML out from the server. See this video.
When the page does display, it's being handed over to you as the user. You need to do something with the browser window to get the server code running again (click a link or button or ...). When the server code does run, it will stop in the debugger again at the start of the page's code. So you need to go back to the Netbeans window and handle its execution there.