xdebug does not activate the breakpoint

2019-08-09 18:44发布

问题:

I am using Netbeans to do my project(codeigniter) and my xdebug is configured in php ini. The following are the setting:

zend_extension = "C:\xampp\php\ext\php_xdebug.dll"
;xdebug.profiler_append = 0
;xdebug.profiler_enable = 1
;xdebug.profiler_enable_trigger = 0
;xdebug.profiler_output_dir = "C:\xampp\tmp"
;xdebug.profiler_output_name = "cachegrind.out.%t-%s"
xdebug.remote_enable = 1
xdebug.remote_handler = "dbgp"
xdebug.remote_host = "127.0.0.1"
xdebug.remote_autostart = 1
xdebug.idekey = "netbeans-xdebug"
xdebug.remote_log="C:\xampp\tmp\xdebug.log"
xdebug.remote_port=9001

Php info shows that xdebug is activated. I set the breakpoint at on of the variable in the login method and started to debug. The link at the login page appears:

localhost/goldilock/index.php?XDEBUG_SESSION_START=netbeans-xdebug

After login in, the breakpoint is not activated and I can't debug and the XDEBUG_SESSION_START=netbeans-xdebug part of the link disappears.

Is there any way the debugging can be activated. I can't find any solution to activate the debugger to the breakpoint.

The xdebug.log says the following:

Log opened at 2013-07-01 05:40:22
I: Connecting to configured address/port: 127.0.0.1:9000.
E: Could not connect to client. :-(
Log closed at 2013-07-01 05:40:23

Log opened at 2013-07-01 05:40:35
I: Connecting to configured address/port: 127.0.0.1:9000.
E: Could not connect to client. :-(
Log closed at 2013-07-01 05:40:36

Log opened at 2013-07-01 05:40:38
I: Connecting to configured address/port: 127.0.0.1:9000.
E: Could not connect to client. :-(
Log closed at 2013-07-01 05:40:39

Log opened at 2013-07-01 05:40:39
I: Connecting to configured address/port: 127.0.0.1:9000.
E: Could not connect to client. :-(
Log closed at 2013-07-01 05:40:40

回答1:

First of all, you do need to turn on xdebug.remote_enable=1 — without that, debugging is not activated and it will not work.

For requests after the first "login", xdebug.remote_autostart should deal with that, but it is possible that Netbeans doesn't accept the new incoming debugging connection. To find out what Xdebug is trying to do, add the setting xdebug.remote_log=c:\temp\xdebug.log and investigate what's in the log. (You might have to change the path).



回答2:

This is what I did with the help of Derick's answer:

Step 1: Change xdebug.remote_port=9000 to xdebug.remote_port=9001

Step 2:

  1. Change the debugging port in Netbeans. Go to Tools >> Options >> Click PHP tab
  2. Under PHP tab click debugging
  3. Change the debugger port : 9001
  4. Change Session ID : netbeans-xdebug

Step 3: Restart server and netbeans

Step 4: Set a breakpoint and try