Question

Netbeans won't connect to xdebug. I've tried suggestions from the following posts:

Debugging IDE's port connection to XDebug: "Waiting to Connect"

netbeans shows "Waiting For Connection (netbeans-xdebug)"

but it doesn't fix my issue.

It seems Netbeans connects to xdebug because while it waits for the connection all request made to the webserver [Apache2] are blocked. Also the port [9001] appears to be in use:

roxy@Pixy011 ~ $ sudo nmap -sS -O 127.0.0.1

Starting Nmap 6.00 ( http://nmap.org ) at 2013-11-28 20:48 EST
Nmap scan report for localhost (127.0.0.1)
Host is up (0.000029s latency).
Not shown: 990 closed ports
PORT     STATE SERVICE
22/tcp   open  ssh
139/tcp  open  netbios-ssn
443/tcp  open  https
445/tcp  open  microsoft-ds
631/tcp  open  ipp
902/tcp  open  iss-realsecure
3306/tcp open  mysql
8080/tcp open  http-proxy
8081/tcp open  blackice-icecap
9001/tcp open  tor-orport   <---- Opened by java

xdebug.ini: [I have confirmed it is loaded in phpinfo()]

zend_extension=/usr/lib/php5/20100525/xdebug.so

xdebug.remote_autostart=1
xdebug.remote_enable=1
xdebug.remote_handler="dbgp"
xdebug.remote_mode="req"
xdebug.remote_host="127.0.0.1"
xdebug.remote_port=9001
xdebug.idekey="netbeans-xdebug"

Netbeans configuration:

Debugger port: 9001
Session ID: netbeans-xdebug
Stop at first line: Checked
All other options are unchecked

Project properties:

Host: 127.0.0.1
Port: 9001

Edit: I've noticed Netbeans doesn't append the XDEBUG_SESSION_STOP to the URL. I don't think this is related to the issue because Netbeans only opens the page after I close the debugging session.

I've also disabled SELinux

Was it helpful?

Solution

On Ubuntu 13.04 64bit php 5.4.9-4 Xdebug v2.2.3 netbeans 7.4
I have same problem and have solve it by:
1. go on http://xdebug.org/wizard.php follow the instructions to compile your own xdebug.so
2. in netbean 7.4 general options (sorry I haven't reputation 10 to post image) test connection. be sure correct settings on Proxy: to me "No Proxy" is working.
3. in php options debugging tab change xdebug setting port to other than 9001 or 9000. I choose 9002 but you can try until you find a free port (if port is not free nb tell you)
4. in php.ini OR for ubuntu users in /etc/php5/conf.d/20-xdebug.ini

zend_extension=/usr/lib/php5/20100525/xdebug.so #where you ave put your reconpiled xdebug.so
[xdebug]
xdebug.remote_autostart=0
xdebug.remote_enable=1
xdebug.remote_handler="dbgp"
xdebug.remote_mode="req"
xdebug.remote_port=9002 # the port you have found free and set in netbeans above
xdebug.remote_host=127.0.0.1
xdebug.profiler_enable=0
xdebug.profiler_output_dir="/tmp/"
xdebug.idekey="netbeans-xdebug"
xdebug.remote_log="/home/#user_name#/xdebug.log" #your user name

5. sudo service apache2 restart

after do this I can debug php again.

OTHER TIPS

I had the same issue and I have tried many solution i had found out there but the issue still occured. I have tried to follow the step discribe in enter link description here

and

enter link description here

And that , whttp://localhost/abc/trunk/abc/backend/web/?XDEBUG_SESSION_START=netbeans-xdebughen i debug my project, my netbeats still waiting connection till i have to had the following "?XDEBUG_SESSION_START=netbeans-xdebug" in my url as http://localhost/abc/trunk/abc/backend/web/?XDEBUG_SESSION_START=netbeans-xdebug so netbeans was able to connect with xdebug

**On Windows 10 with Netbeans 8.0 running Netbeans built in webserver **

The following options in the php.ini file resolved the issue for me:

zend_extension ='C:\path to php installation\ext\php_xdebug-2.5.0-5.6-vc11.dll' xdebug.remote_enable=on

This issue for me seemed to be resolved by using the full path to the .dll file. Also, because I had spaces in the path name I had to enclose the path in quotes (double vs single did not seem to matter). Also, I had to set the xdebug.remote_enable option. Once I set both options, I was able to select the Debug Application option within Netbeans and the debugger started.

i was facing a similar problem, in my case i had recently update my php version and the xdebug configuration were in the only php5 folder. had simply had to copy the old xdebug configuration to the new php.ini file of the new version and it worked like before.

some of the tips to debug this are:

  1. first check if xdebug is install, run (php -v) if xdebug details aren't there then install and add the configuration.
  2. open phpinfo() under xdebug category check if xdebug configuration is loaded.Check for the following settings.
    • remote_enable = on,remote_handler=dbgp

I faced the same issue to get xdebug worked in virtualbox ubuntu machine with Netbeans.

PHP version 7.4

Changed following file

"/etc/php/7.4/apache2/conf.d/20-xdebug.ini"

and added following lines

zend_extension="/usr/lib/php/20190902/xdebug.so"
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.remote_log = "/var/log/xdebug.log"

Plese note that the line below consists double quotes for defining the path.

zend_extension="/usr/lib/php/20190902/xdebug.so"

Had same issue:

$ netstat | grep 9000
...
tcp6       1      0 localhost:9000          localhost:37486         CLOSE_WAIT

Solution: Restart NetBeans. There was running a dead Process waiting for connections.

Here Netbeans with a running debug session. Note the CLOSE_WAIT and TIME_WAIT.

tcp6       0      0 localhost:9000          localhost:38166         TIME_WAIT 

For Xdebug v>=3

If you are still facing issues after trying all above answers. And you have Xdebug version >=3 then only try my steps.

Some settings have been changed in v3.

  1. Xdebug's default debugging port has changed from 9000 to 9003. So change it in php.ini and netbeans IDE.
  2. In php.ini
  • add xdebug.start_with_request="yes"

  • add xdebug.client_host = localhost . (The old xdebug.remote_host=localhost is no longer useful in v3)

  • add xdebug.mode=debug

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top