Netbeans 8.0.2 Debugger Breakpoints Not Working

2019-09-12 09:24发布

问题:

I just installed Netbeans for PHP (version 8.0.2). XDebug seemed to come with this installation. I'm trying to get the breakpoints and stepping through the code to work on my local machine, which is running WAMP, to work.

I've never used debugging for PHP; only with Excel VBA, so I'm familiar with how breakpoints and stepping through code works. It seems that this feature comes with Netbeans/XDebug.

But when I click on the debug button on the top middle of the screen, a bunch of buttons pop up. A good portion of them are greyed out and I am not able to use them. Specifically, the continue, step over, step into, step out, and run to cursor. The stop button is there, but works fine. When I click on debug, a new browser window opens and my code displays in the browser. It seems to ignore the breakpoint that I have placed in my code, though.

I have breakpoints in my code, just to see how it all works in a PHP IDE, but I can't seem to get the breakpoints to work. My code is really nothing fancy; all I have is what is below:

<?php
echo "Hello world!<br />";
echo "Google Chromium.";

I have a breakpoint on line 2 where it says "Hello world!" (I clicked on the left side of the code and a red box displayed next to the line of code).

I am not really sure where to start with fixing this. XDebug shows up in my phpinfo() as version 2.2.5. I've seen some questions address changing some of the parameters in php.ini, but each seems very specific to the person who posts problem. I've checked the port to make sure it's 9000, I've also placed/changed the following code in my php.ini file:

[xdebug]
xdebug.remote_enable = on
xdebug.profiler_enable = on
xdebug.profiler_enable_trigger = off
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir = "c:/wamp/tmp"
xdebug.show_local_vars=0

xdebug.remote_handler=dbgp 
xdebug.remote_host=localhost 
xdebug.remote_port=9000

How do I get breakpoints to work and stepping through code to work with Netbeans and XDebug?

回答1:

Check php.ini. Parameter xdebug.extended_info mast be equal to 1.

xdebug.extended_info = 1