netbeans xdebug waiting for connection despite going through all forum answers
Asked Answered
N

3

2

I get the message "waiting for connection (netbeans-xdebug)" when using netbeans debugger.

I am using: Windows 10 XAMPP for Windows 5.6.20 XAMPP control panel v3.2.2 NetBeans IDE 8.0.2

I have been round and round the forum answers for days trying everything but have drawn a blank.

The code in php.ini is :

> [XDebug]
; Only Zend OR (!) XDebug
zend_extension = c:\xampp\php\ext\php_xdebug-2.5.4-5.6-vc11.dll
xdebug.remote_autostart=on
xdebug.remote_enable=1
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9001
xdebug.remote_handler="dbgp"
xdebug.profiler_enable=1
xdebug.profiler_output_dir="c:\xampp\tmp"
xdebug.remote_mode=req
xdebug.idekey="netbeans-xdebug"

I have tried every combination of parameters for the above imaginable.

The port I have used in netbeans is: project properties > Run Configuration > Advanced: 9001 Netbeans > Tools > Options > PHP > Debugging : 9001

Could it be significant that the debugger is using the Chrome browser, but my phpmyAdmin and the home screen for XAMPP are on IE?

Nyctaginaceous answered 14/9, 2017 at 19:55 Comment(0)
K
2

I'm not sure about Windows, but in later versions of PHP on linux (starting from at least 5.4) the xdebug configuration is in a separate file. Mine is in:

/etc/php/7.0/apache2/conf.d/20-xdebug.ini

If you don't have a dedicated xdebug ini file, make sure you are editing the right php.ini. In my system there are 3:

/etc/php/7.0/apache2/php.ini
/etc/php/7.0/cli/php.ini
/etc/php/7.0/phpdbg/php.ini

Here is my xdebug configuration:

xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_mode=req
xdebug.remote_port=9000
xdebug.show_local_vars=on

A few considerations:

  1. I see your port is different from mine (9000 vs 9001). Go to Tools->Options->PHP, at the "Debugging" tab make sure the "Debugger port" corresponds to the one specified in xdebug.remote_port.

  2. Try to use localhost instead of 127.0.0.1

  3. Make sure the output of phpinfo() contains information about xdebug. If you don't have an "xdebug" section you probably need to check the zend_extension path.

  4. I remember reading on the NetBeans mailing list that a few people had problems caused by the Windows firewall, maybe you can try to disable it.

Kelpie answered 15/9, 2017 at 7:52 Comment(3)
I only have one in /xampp/php/php.ini. It also comes up in the xampp control panel configuration. So it definitely the only one. I don't have an xdebug configuration. I am using PHP Version 5.6.20.Nyctaginaceous
I added a few suggestions to my answer, I hope they will help you identify the problem.Kelpie
Thanks a million. I thought I would be stuck forever! Your 2nd suggestion about using localhost instead of 127.0.0.1 worked for me. Thanks also to @shashanth for suggesting your suggestion.Nyctaginaceous
C
1

A lot many people facing the same problem. This awful error/bug seems from Netbeans itself not from X-Debug. I also faced the same problem with Netbeans.

Your php.ini file configuration looks fine. Try @paolosca's answer. If that didn't work try the below suggestions.

After right click on your project name in Netbeans and select Properties -> Run Configurations

Now you'll see project run configurations. There select index file (Ex, index.php) then in Arguments field pass

XDEBUG_SESSION_START=netbeans-xdebug

as argument to index.php file. That you should start debugging the PHP code.

If you think it's a long way you can directly pass the arguments as below. Say you have the url like,

http://localhost/foo-project/index.php

then pass the argument like this in browser's url window

http://localhost/foo-project/index.php?XDEBUG_SESSION_START=netbeans-xdebug

and hit Enter.

To answer your last question

Could it be significant that the debugger is using the Chrome browser, but my phpmyAdmin and the home screen for XAMPP are on IE?

I don't think so.

Conveyancer answered 16/9, 2017 at 8:17 Comment(2)
Thanks for your suggestions. One of @Kelpie 's answers (localhost for 127.0.0.1) worked form me.Nyctaginaceous
That's great. Happy coding.Conveyancer
H
0

This might help someone in the future, if the above did not help. Turn off the "Personal Networks Firewall" in Windows Defender in Windows 10:

Control Panel\System and Security\Windows Defender Firewall

After spending hours and hours trying everything without success, this finally did it for me...!

Hillard answered 4/9, 2018 at 9:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.