14

Im trying to configure xdebug to work with Netbeans 6.9 and php 5.3
As far as i concern i have setup xdebug properly.
I can see xdebug extension from phpinfo page.
I have read other post and tried their suggestion but up to no avail

When i hit the debug button, it straight open the page in the browser and i can see message 'Waiting for connection' in the bottom pane of netbeans

Here my setting in php.ini

zend_extension = /usr/lib/php5/20090626+lfs/xdebug.so
xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.idekey="netbeans-xdebug"

Any help would be appreciated

slier
  • 6,511
  • 6
  • 36
  • 55
  • And the page in browser loads or is turning white with no output? – dev-null-dweller Dec 24 '10 at 23:08
  • it simply open the page i want to debug.. – slier Dec 25 '10 at 18:28
  • For me problem was invalid path to xdebug.so. Make sure the path is correct when declaring zend_extension ! – NenadP May 17 '13 at 09:49
  • I spent a little time to debug this and finally found that the issue was that when netbeans launches xdebug it goes to HTTP://LOCALHOST?XDEBUG_SESSION_START=netbeans-xdebug and there was an htaccess that messed with redirect. So changing host to HTTP://LOCALHOST/index.php resulted in getting it to work. So HTTP://LOCALHOST/index.php?XDEBUG_SESSION_START=netbeans-xdebug – ToughPal Feb 19 '14 at 07:29

8 Answers8

15

First, check that it isn't actually working for you, and you don't notice. I've done this...convinced it's not working I wasted a chunk of time trying to get it to work, only to find that everything was OK.

Look at your NetBeans status bar. If you see "netbeans-xdebug" and "running" then it is actually working just fine. You probably have the "Stop at first line" option turned off and you didn't hit any breakpoints you set (if any) yet. That would be a reason you are seeing the page with little or no indication that the debugger is actually connected.

If you instead see "Waiting for Connection (netbeans-xdebug)" and the progress bar is cycling, then you are indeed not connected. Open Tools|Options, and go to the PHP page. On the general tab, make sure that the "Debugger port" is 9000 and the "Session ID" is "netbeans-xdebug". You may want to have "Stop at First Line" checked. I don't, as I find it a bit annoying. I would definitely ensure that "Watches and Balloon Evaluation" is not checked. This option causes NetBeans and the debugger to destabilize. If you need a watch, hack a local variable into the PHP code where you need it, and you'll see it on the "Variables" tab when the debugger is running. Also, confirm that file (index.php) is specified in the project's Run Configuration > Index File.

Since you see xdebug in phpinfo(), that end of it is fine. Just make sure that all of the values look reasonable, and that there is some reference to a cookie "XDEBUG_SESSION=netbeans-xdebug" somewhere on that page. (Make sure that you don't have cookies turned off on the browser!)

The only other thing to check is to see if some firewall/security program is running that would be blocking TCP/UDP locally (which would be super-odd, but not out of the realm of possibility), or that port 9000 isn't already used by another application. I am using a different port number in my local setup for some reason. I don't remember changing it, but I am sure that the only reason I would have is if I had hit a port conflict with something else.

One last thing... We've been assuming that you are running NetBeans and the web server on the same computer. That's a common configuration, but not the only one. If your web server is on a different computer, then change the localhost in xdebug.remote_host=localhost to the IP address of the computer on which NetBeans is running.

Another last thing: When cycling through frustrating iterations, until you see xdebug info in phpinfo(), restart apache/php. Once there, still restart NetBeans between iterations. And believe it or not, restart your browser.

texas-bronius
  • 558
  • 4
  • 11
RobertB
  • 4,592
  • 1
  • 30
  • 29
  • i already do all of ur suggestion but up to no avail.i been googling for couple of days,still cant figure it out.I simply get 'Waiting for Connection'.. in NB status bar – slier Dec 29 '10 at 21:00
  • Try re-downloading and replacing your xdebug.so. Don't forget to stop and restart Apache (or whatever). Also, just to be sure, am I correct in assuming that your instance of NetBeans and your web server are running on the very same computer? – RobertB Dec 29 '10 at 22:16
  • ok xdebug only work when there is index.php on my project directory.if there is no index.php it simply stated 'waiting for connection'.is this a common behaviour? – slier Jan 01 '11 at 23:00
  • This sounds familiar. I have a few projects that are pieces of a main project. The main project has the index.php. In order to debug the sub-project I usually end up copying over the main project's index.php temporarily. I seem to remember, however, that if the index.php was not present, that NetBeans would not even allow me to start the debug session. I seem to remember that it tells me it cannot debug because it cannot find the index.php. – RobertB Jan 01 '11 at 23:16
  • well that explain something.NB should provide more friendly error message...thx for ur input Robert – slier Jan 04 '11 at 00:25
  • xdebug.idekey="netbeans-xdebug" And a restart of Apache did work for me :) – eddy147 May 16 '11 at 20:13
  • i just don't get netbeans xdebug running. xdebug show up fine in phpinfo() and even netbeans listens to 9000 just fine. but netbeans does not start the browser. till i stop the debugging session. then it opens up the browser with "?XDEBUG_SESSION_START=netbeans-xdebug". no error message except that xdebug is not installed.. i even removed apparmor.. i'm at my end – iRaS Nov 20 '12 at 00:03
  • I added one comment about specifying the index file in the project's Runtime Configuration. In my case in particular, the slightly non-standard Drupal folder structure forced me to navigate to the real index.php in a path that NetBeans understood but that was not actually correct. The result is that first launch of Xdebug Session from NetBeans lands me on a Drupal 404, but unlike without it, my XDebug session was active. – texas-bronius Apr 10 '14 at 05:18
  • Ok one more for the wayward sojourner! I believe what finally really did it for me was restarting Chrome-- different sessions, didn't matter. But once I restarted Chrome, it worked instantly as expected. If it were windows, I'd have restarted the PC ;) – texas-bronius Apr 10 '14 at 16:23
3

For me it was changing

;xdebug.remote_enable = 0 (default value in clean XAMPP installation)

to

xdebug.remote_enable = 1

did the trick

dreamcrash
  • 47,137
  • 25
  • 94
  • 117
Pat
  • 31
  • 1
1

Adding an index.php did the trick for me.

user545402
  • 11
  • 1
0

I couldn't figure out why some of my projects would connect to the debugger and others wouldn't. Then I realized that the ones that wouldn't connect started with index.html. Once I renamed these files to index.php, the debugger connected with no problem.

Simpler
  • 1,317
  • 2
  • 16
  • 31
0

I solved this using a windows -> remote LAMP server config after reading the following post, leaving the link in case anyone finds it handy:

http://stuporglue.org/setting-up-xdebug-with-netbeans-on-windows-with-a-remote-apache-server/comment-page-1/#comment-6227

James Scott
  • 1,032
  • 1
  • 10
  • 17
0

Having just upgraded to the new Ubuntu 14.4 my NetBeans Xdebug stopped working. I've followed all the answers above to date to no avail.

I found a NetBeans Ubuntu statement that the /etc/php5/cli/conf.d/xdebug.ini file should have xdebug.remote_enable=on. When I checked the /etc/php5/cli/conf.d directory, I found no xdebug.ini file. However there was a link to /etc/php5/mods-available/xdebug.ini there. Subsequent adding the xdebug.remote_enable=on to that file fixed the problem.

PS - This works on NetBeans 8.0.1

0

When I tried to debug the Yeoman WebApps powered by PHP backend in Netbeans, the status keep showing 'Waiting for connection'. There's probably because the index.html has nothing to do with php at all. It's only when I've triggered the ajax which needed PHP processing, the connection with xdebug immediately connected and debug as usual. Hope this give another perspective to someone as I have stumbled to 'think' there is a problem and trying to fix the ini.

ken
  • 13,869
  • 6
  • 42
  • 36
0

An alternative is the Dephpugger project. Is like ipdb in python or byebug in Ruby. https://github.com/tacnoman/dephpugger

Is very easy to use.

Renato Cassino
  • 792
  • 1
  • 7
  • 27