Firstly I'll apologise for clogging up the internet with yet another post about Netbeans and XDebuug but after two weeks of trying to get XDebug to work connecting remotely from Windows 7 to my dev machine, I'm left with no alternative. FYI, I've done extensive research into the issue but have run out of quality search results to read.
In summary when trying to attach the debugger I get 'Attaching to 127.0.0.1:9000\r\nConnection refused.', If I try to debug a file through right-click/debug file I get 'Waiting for connection'
In detail here is my XDebug.ini file under /etc/php5/apache2/xdebug.ini:
zend_extension=/usr/lib/php5/20090626+lfs/xdebug.so
xdebug.remote_enable = on
xdebug.remote_autostart = off
xdebug.remote_handler = dbgp
xdebug.remote_port = 9000
xdebug.remote_server = localhost
xdebug.remote_mode = req
xdebug.idekey = netbeans-xdebug
output_buffering = off
xdebug.remote_log = "/var/log/xdebug.log"
My system specs are:
My laptop:
- Windows 7
- Netbeans 7.4
- Debug browser: Chrome Version 30.0.1599.101 m
My server:
- Linux Debian Ubuntu 11.10
- PHP 5.3.6-13ubuntu3.10
- Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethan [Confirmed running under php_info()]
How i'm trying to connect:
Following Stuporglues tutorial, I have xdebug and netbeans configured to run on port 9000 (under xdebug.ini and netbeans->tools->options->php->debugging) using a putty connection with port 9000 forwarded as remote under ssh->tunnels (9000/127.0.0.1:9000).
I can see that the Linux server is listening:
james@XXX:/$ netstat -a -n | grep 9000
tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN
tcp6 0 0 ::1:9000 :::* LISTEN
When I try to debug a file I can see that Netbeans is listening on port 9000
netstat -aon
...
TCP 127.0.0.1:9000 127.0.0.1:59691 ESTABLISHED 6744
Also, the browser (chrome) opens with the debugging parameter in the address bar correctly:
https://xxxxx.xxx/xxxxx/dMotor1_2PropZ.php?XDEBUG_SESSION_START=netbeans-xdebug
But Netbeans just hangs with 'waiting connection'
Things tried:
- I've extensively checked all the applicable firewalls, disabling the windows bundled firewall, and also wiping out iptables and ip6tables on my server, no effect.
- I've tried duplicating the project under http not https in case this was causing issues, no effect
- All types of XDebug.ini settings
- Disabling 'open browser' under project->properties->Run Configuration->Advanced->Debug Url and manually opening the page in chrome with the XDEBUG_SESSION_START parameter correctly appended, no effect
- Under project->properties->Run Configuration->Advanced->Debug Url choosing 'ask every time' with the index.php setting under project->properties->Run Configuration blank, no effect
- Under project->properties->Run Configuration manually appending the XDEBUG_SESSION_START argument as such: netbeans-xdebug, no effect
- Rebooting my computer, restarting Apache and restarting my remote machine endlessly, no effect
- Enabling 'silent debugging mode in chrome', no effect
- Adding the '--remote-debugging-port=9000' option to chromes startup shortcut runpath, no effect
- Installing PHPStorm to see if by I can get any further, no effect
- Using different browsers (have tried Firefox and IE), no effect
- Reinstalled XDebug, after using the wizard to ensure the version is compatible with my PHP release, no effect
- Creating index.php in case this help, no effect
- Setting timezone in php.ini file, no effect
Current theories:
Connection refused? Is there really something blocking the connection? If so, how would I find it? I've tried everything I can think of. Otherwise is this a default error message that's masking a completely different problem?
Further information:
Honestly, its probable I've missed something simple here and have dived far too deep to realise easily, this is the first time I've tried to get XDebug to work on a remote machine and my Linux admin and Netbeans experience is limited.
Even more strangely, I got it working once under the described configuration in my office, then I put my computer on standby and went home, at this point I was also able to run with debug once and then without changing any settings, the problems described above began.
XDebug log file has contained 'could not connect', but currently does not add new content.
Any help would be really appreciated.
Thanks in advance,
James