2
votes

I am trying to use Xdebug in combination with NetBeans to debug my PHP code. And it is already working as expected when setting a xdebug_break() statement within my code, i.e. the execution stops at the line after it.

Though it does not work when I set a breakpoint for a line within the NetBeans UI.

My configuration looks like this:

Programs:

  • NetBeans 8.1
  • Xdebug 2.4.1 (Thread Safe, 64-bit)
  • PHP 5.6.26 (Thread Safe, 64-bit)

Configuration:

php.ini

zend_extension="C:\Program Files\PHP\ext\php_xdebug-2.4.1-5.6-vc11-x86_64.dll"

[xdebug]
xdebug.remote_enable = On
xdebug.idekey = NetBeans
xdebug.remote_port = 9001
xdebug.var_display_max_children = 1024

NetBeans:

NetBeans PHP debugging configuration

NetBeans project run configuration

NetBeans advanced web configuration

So, why does xdebug_break() work but not the breakpoints?

1
if you run your page with "XDEBUG_SESSION_START=netbeans-xdebug" parameters does it help? like this localhost/?XDEBUG_SESSION_START=netbeans-xdebug - R A
NetBeans does that automatically when I click the Debug Project button. Note that my IDE key is called "NetBeans"; so the page is called with XDEBUG_SESSION_START=NetBeans as parameter. - Sebastian Zartner

1 Answers

2
votes

It turned out that the reason for this unexpected behavior was that the project URL in the run configuration was wrong. The Project URL field actually requires to set the project's root URL and the Index File field takes the index file path.

So, instead of writing this:

Project URL: http://localhost/project_name/some/path/
Index File: index.php

I had to write this:

Project URL: http://localhost/project_name/
Index File: some/path/index.php