I've spent quite a lot of today getting XDebug to work with Netbeans on Windows 8.1, most of the help I found online was incomplete so I've decided to compile it here into a guide that works (at least on my workstation!).
- Download and install the Java runtime (I used version 7 update 45).
- Download and Install Netbeans (I used version 7.4, HTML5 & PHP option).
- Download PHP 5.4 zip file and extract to "d:\php" (I used "VC9 x86 Non Thread Safe"). Make sure to get a Windows Binary zip file.
- Download and install "Visual C++ Redistributable for Visual Studio 2012", (get the x86 version regardless of your PHP choice)
- Download the version of XDebug which corresponds to the version of PHP you downloaded, place the DLL file in your "d:\php" folder (I used "PHP 5.4 VC9 (32 bit)")
- Create a "php.ini" file in "d:\php" and populate it with the following (replace YOURDLLFILENAME with the precise filename of your XDebug DLL. Mine was php_xdebug-2.2.3-5.4-vc9-nts.dll). :
output_buffering = Off
date.timezone = Europe/London
- You can now test the PHP install by running the following from a command prompt (note the capital S!):
D:\PHP\php -S localhost:80
Assuming that works, push Ctrl+C to stop the service, then type 'exit'.
- That's everything installed, now on to the configuring. Open Netbeans!
- In Netbeans, go to Tools > Options > PHP > General, on this tab set 'PHP 5 Interpreter' to 'd:\PHP\php.exe'.
- In Tools > Options > PHP > Debugging. You shouldn't need to change anything here, the important thing is that 'Debugger Port' matches 'xdebug.remote_port' in your 'php.ini' and that 'Session ID' matches up to 'xdebug.idekey'.
- Create a new project, or edit the properties on an existing project. The important setting here is 'Run Configuration'. Make sure that 'Run As' is set to 'PHP Built In Web Server', Hostname is 'localhost' and Port is '80' (this doesn't have to be 80, but it must be different to the port used to send debug data).
- The project must have a file called 'index.php'. Create the file, enter some code and create a breakpoint (Ctrl + F8).
- Cross your fingers and start 'Debug Project' (Ctrl+F5) a browser window should pop up, and your code should stop at your specified break point. The Windows Firewall may pop up at this point, you don't need to grant any access for the local debugging to work.
This post was compiled from quite a few answers found on Stack Overflow, as well as some of my own experimentation/research.