Connecting Xdebug with NetBeans and Vagrant - netbeans

I have spent quite a bit of time on this with no success. I am trying to connect my Xdebug through NetBeans to my Vagrant server.
The IP address of the Vagrant box is 192.168.33.10.
When NetBeans opens the debugging connection it says that it's looking at 192.168.33.1.
My php.ini settings are as follows
zend_extension=/usr/lib/php/20151012/xdebug.so
xdebug.profiler_enable=1
xdebug.profiler_output_name="cachegrind.out.%t.%p"
xdebug.collect_params=4
xdebug.collect_return=1
xdebug.remote_enable=1
xdebug.remote_log = /tmp/xdebug.log
xdebug.remote_port = 9000
xdebug.remote_host=192.168.33.1
xdebug.remote_handler="dbgp"
xdebug.remote_autostart=0
xdebug.idekey="vagrant"
xdebug.remote_mode=req
;xdebug.remote_connect_back=1
In NetBeans my project URL is set to http://192.168.33.1:9000
debugger port is 9000 and Session ID is vagrant.
I know that NetBeans also looks at IP address 10.0.2.2 and I can't get this going either. When I run the debugger NetBeans just says that it's waiting for connection and my log stats that the connection has timed out.
I have also tried it with remote_connect_back=1 and to no avail.

Thank LazyOne for your feedback much appreciated
What I had to do to get this going was to open the ports 9000 on my windows machine and port 9000 on my server. I then login to my ssh server connecting to 127.0.0.1:2222 as specified by the vagrant bootup messages. Then set up a ssh tunnel to connect to port 9000. I did this using putty

Related

Remote xDebug not connected to NetBeans, despite the xdebug and ssh-tunnel works?

I have a trouble with the connection from remote xDebug to local NetBeans debugger.
Synopsis:
Remote server: FreeBSD (shared hosting, no root), Apache/Nginx, PHP5.6.
I've installed and configured xdebug with following settings in php.ini:
[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/"
USERNAME - is a real user name folder... in other words, the paths are correct, it is tested.
autostart - is just for now, until I will solve a problem.
phpinfo() tells me that xdebug installed successfully.
Local machine:
Windows XP, NetBeans, firewalls are off.
I have no a reserved IP, so I've created a reverse SSH-Tunnel via Putty:
R9009 - localhost:9009
Remote 9009 port forwards to local 9009, everything seems simple.
Next I went back to remote server and check the tunnel by netstat -a|grep 9009
tcp6 0 0 localhost.9009 *.* LISTEN
Ok, next I checked xDebug activity by refreshing my website page in my browser; due to autostart options any request should cause a xdebug data transmittion, and my test shown me that xdebug works well:
tcp4 0 0 nosorog.nichost..14107 localhost.9009 SYN_SENT
tcp6 0 0 localhost.9009 *.* LISTEN
Ok, xDebug tries to establish connection to localhost:9000, but nothing happens on my local machine...
xdebug's log contains the timeout message:
E: Time-out connecting to client. :-(
So, what I've tried:
First, I decided to re-check if ssh-tunnel works. I just ran simple python script-listener on local machine, and ssh -p 9009 localhost on remote server, and connection was successful.
Ok, tunnel works well.
BUT neither netbeans nor listener-script receive any connection when xdebug tries to establish connection.
UPD:
I've tried to establish connection with telnet or nc, and that was successfull too...
So at this moment:
if I try to connect from remote to local via ssh or telnet or netcat - connection is successfull (test script accepts connection, netbeans ignores (if I connect via ssh or telnet) or crashes (if i connect via netcat), but wireshark sees packets in both cases);
but if xDebug or test script with sock.connect(('localhost', 9009)) tries to connect - there are SYN_SENT port state and timeout erroron remote machine, and no reaction on local machine (just LISTEN at port 9009 and nothing at all in wireshark)
I guess the clue is what is the key difference between first and second cases?

eclipse debug can not connect to VM

Eclipse remote debug: can not connect to VM.
After starting tomcat,
telnet localhost 8787
works.
Then in eclipse, I tried to enable remote debug, got error: can not connect to VM.
telnet localhost 8787
will not work anymore.
What is the problem? It suddenly stopped working without any reason.
Thanks.

Remote debugging tomcat with OpenShift

I am using openshift for my tomcat webapp. I am able to run the app but unable to debug it. As openshift starts tomcat in debug mode, I was expecting I'll be able to debug.
Host:
$OPENSHIFT_JBOSSEWS_IP
Value of this is 127.5.20.129 for me which I got from command:
rhc port-forward -a {appname}
Port:
$OPENSHIFT_JBOSSEWS_HTTP_PORT
Value is 8080 for me.
I tried above host/port. I tried port 8000 too but nothing works. I am unable to connect from eclipse remote debugger each time.
Please help.
You should read through the Developer Portal's pages on Port Forwarding (https://developers.openshift.com/en/managing-port-forwarding.html) to make sure that you are using it correctly. You will want to connect to your local loopback address: 127.0.0.1 along with the correct forwarded port once you have run the port-forwarding command.

Use a Vagrant machine as SFTP connection in NetBeans

I have a little trouble using NetBeans to work on my Vagrant virtual server. What I tried is to create a new PHP Project on a remote server, then NetBeans ask me for the connection so I created a new connection. For hostname I putted in 127.0.0.1 and as user vagrant I linked the private key file (generated by vagrant) and filled in the initial directory.
When I try to connect like this it asks me for the password for user vagrant (which I don't have, since it should provide the private key file...). With Vagrant I would need to connect to port 2222 instead of 22 for ssh connections anyway, so I changed the hostname to 127.0.0.1:2222. Now I get a java.net.UnknownHostException: 127.0.0.1:2222
Therefore the question: Was anyone of you able to connect to a vagrant machine with SFTP using NetBeans? If yes, how?
Note: Not sure if it's important, but I'm using an Ubuntu 14.04 machine and my NetBeans version is 8.0.2, I've installed the PHP/Web package.
I realize this was asked a long time ago, but it seems like other people have this issue as well. This works for me on my Mac:
Host: 127.0.0.1
Port: 2222
Protocol: SFTP
user: vagrant
pass: vagrant
You end up in the vagrant home directory /home/vagrant.

Trying to connect to a remote server using Eclipse

I have an Ubuntu server running Tomcat, and I want to connect my Eclipse EE to it so I can work with JSP.
I have no problem connecting to a similar Tomcat service when it's installed on my machine (not a server), but whenever I try to connect to the remote server I don't seem to have the option of choosing a Tomcat service.
Is there some guide you can recommend (I didn't find one), or is there something I did wrong?
The "remote" Tomcat (or more generally the app server) must be configured to permit such connection.
Did you start the remote server with these parameters:
-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n
Alternatively you can add the word jpda at the end of the startup.sh (or .bat) script just when calling the catalina.sh script.
Everything is documented on the Apache Tomcat Wiki.
After enabling those options, you have also another task to do: enabling the network connection to the configured port (8000 in the above options). It depends which firewall is installed on the server but usually it is iptables.
Example of iptables command to enable connection to port 8000:
sudo iptables -A INPUT -p tcp --dport 8000 -j ACCEPT
If your server have a GUI installed, one easiest way is to use the "ufw" – short for 'uncomplicated firewall' as explained in this site which is just a graphical way to configure the iptables.
One way to test the connectivity to the server (if the port is open) is to use telnet from your computer like this:
telnet your.distant.host 8000
and if the command opens, the port is accessible, if the telnet command times out, the port is closed.