A
A
Alexander X2016-11-15 05:55:36
linux
Alexander X, 2016-11-15 05:55:36

Netbeans / xdebug (remote) - connection fails... what am I doing wrong?

Good day.
I can't get xdebug on a remote server (freebsd) to work with neatbeans on my local machine (windows). Please suggest what and where else can be tweaked?
So, what we have:
On the server:
Hosted by Ru-Center, FreeBSD/Apache/Nginx, PHP 5.6, installed xdebug,
PHP.INI (in the xDebug part):

[debug]
zend_extension="/home/USERNAME/usr/php/lib/xdebug.so"
xdebug.remote_enable=1
xdebug.remote_autostart=1
xdebug.remote_host=localhost
xdebug.remote_port=9009
;xdebug.remote_connect_back=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.idekey="netbeans-xdebug"
xdebug.remote_log="/home/USERNAME/logs/xdebug/xdebug.log"
xdebug.profiler_output_dir="/home/USERNAME/logs/xdebug/profiler/"
xdebug.trace_output_dir="/home/USERNAME/logs/xdebug/trace/"

instead of USERNAME - everywhere the user's correct folder, of course;
autostart - yes, this is temporary, until I get xdebug working...
phpinfo reports that xdebug is working successfully, all configuration is displayed the same way as specified in php.ini.
Locally - WinXP, NetBeans, firewall disabled (both standard and Komodo).
The difficulty is that the IP address is NOT allocated , so explicitly setting xdebug.remote_host on the remote is not an option ... therefore, using PUTTY, a reverse SSH tunnel is forwarded:
R9009 - localhost:9009
Remote port 9009 - forwarded to local 9009, everything seems to be standard;
Remote netstat -a|grep 9009 shows that the tunnel is there:
tcp6       0      0 localhost.9009         *.*                    LISTEN

If I poke into the site - xdebug starts sending something to localhost:9009 :
tcp4       0      0 nosorog.nichost..14107 localhost.9009         SYN_SENT
tcp6       0      0 localhost.9009         *.*                    LISTEN

BUT! neither the connection nor the data on the tunnel reach the local machine.
Now the oddities:
And everything would be fine, it would be possible to sin on a lot of things - on the firewall, on the provider, on the closed ports of the hoster (although I paid extra for opening ports for entry and exit), if not for one BUT:
To check the tunnel's performance I run a simple listener locally:
from socket import *
from time import sleep

host = ''
port = 9009
sock = socket(AF_INET, SOCK_STREAM)
print 'sock.bind...'
sock.bind((host, port))
sock.listen(5)
while 1:
  print '  sock.accept - listening for incoming connection...'
  conn, addr = sock.accept()
  print '  connected from '+str(addr)
  sleeptime = 10
  print '    sleep for ' + str(sleeptime) + ' sec before force close connection...'
  sleep(sleeptime)
  print '    conn.close...'
  conn.close()
  print '    disconnected from '+str(addr)
print 'sock.close...'
sock.close()

I remotely start
ssh -p 9009 localhost
And it turns out that there is a connection (the listener on the local machine accepts an incoming connection from the server, netstats on both machines see a successful connection, in general - an idyll).
But for some reason, no one else (except this command) on the server can reach the local machine through it. And no one else (except this listener) on the local machine - notices the signals from the server through this tunnel.
TOTAL, all possible options were tried on the server and locally:
From the server:
- ssh -p 9009 localhost
- with a test script like the listener above
- in fact, xdebug (because autostart, any request to the site initiates sending data to localhost: 9009 )
On the local machine :
- the listener above
- actually NetBeans waiting for a connection from xDebug
Of all the above, only one combination (ssh remote and listener local) shows a connection, which indicates that the tunnel is alive in principle. The test script on the server falls off by timeout ,
xDebug writes the same "E: Time-out connecting to client. :-(" to the logs, while the netstat on the server sees the data being sent in both cases.
take up a port on LISTEN, and (apart from the above ssh+listener combo) don't show any sign of a connection
Q:
What the hell else could I be missing
Thanks in advance for any thoughts.
PS and yes, my knowledge of unixes and network tricks is quite superficial, so I fully admit that the reason may turn out to be idiotic :)
UPD:
subtotals:
- I can get through from there using ssh and telnet; in both cases, the test listener on the local machine accepts the connection, if it listens with netbins, it ignores it, but wireshark still sees the packets;
- xdebug and the test script sock.connect(('localhost', 9009)); in both cases, SYN_SENT on that side and a timeout dump, on this side - zero response both in netstat and in wireshark;

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikon_NLG, 2016-11-15
@Nikon_NLG

And what kind of mistake is that? And you have remote_host = localhost. Are you connecting to xdebug through a tunnel?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question