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

4
  • And the page in browser loads or is turning white with no output? Commented Dec 24, 2010 at 23:08
  • it simply open the page i want to debug.. Commented Dec 25, 2010 at 18:28
  • For me problem was invalid path to xdebug.so. Make sure the path is correct when declaring zend_extension ! Commented May 17, 2013 at 9: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 Commented Feb 19, 2014 at 7:29

8 Answers 8

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.

Sign up to request clarification or add additional context in comments.

9 Comments

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
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?
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?
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.
well that explain something.NB should provide more friendly error message...thx for ur input Robert
|
3

For me it was changing

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

to

xdebug.remote_enable = 1

did the trick

1 Comment

thanks, that solved it for me. Worth noting, this line goes to the php.ini.
1

Adding an index.php did the trick for me.

1 Comment

Could you please elaborate on that?
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.

Comments

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

Comments

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

Comments

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.

Comments

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.