Reputation: 1084
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:
My server:
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:
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
Upvotes: 0
Views: 4026
Reputation: 1
For all the WINDOWS users ........
This technology is based on the unix world and it uses /etc/hosts file to resolve all the hostname including the localhost.
And therefore; even on the windows it is looking for the "hosts" file which is located in the c:\windows\system32\drivers\etc .
Edit your hosts file and add the localhost or whatever host you want your xdebug.remote_host to be.
e.g.
127.0.0.1 locahost
192.168.0.101 abojmsi
This will solve not only this problem but almost all your problems with apache.
Upvotes: 0
Reputation: 4197
Have you tried to change the remote_server INI directive?
I am having Win7 on my development pc and Ubuntu 12.04.3 on my server and my ini contains the following directives for xdebug:
[xdebug]
xdebug.auto_trace = 0
xdebug.collect_params = 1
xdebug.show_mem_delta = 1
xdebug.collect_params = 1
xdebug.profiler_append = 0
xdebug.profiler_enable = 0
xdebug.profiler_enable_trigger = 0
xdebug.remote_enable = 1
xdebug.remote_port = 9000
xdebug.remote_handler = "dbgp"
xdebug.remote_host = "MY_HOSTNAME"
and it works like a charm
Upvotes: 1