title: PhpStorm ssh tunnel to remote server - anything to configure on remote server?
body: <p>I have literally been struggling with this for <em>weeks</em>. I gave up and successfully connected to a local virtual machine, but it is too slow. I <em>have</em> to connect to this remote machine even if it kills me.</p>
  
  <p>I have PhpStorm 9.0.2 on my Windows 8.1 machine, trying to use PuTTY to connect to remote CentOS 6, PHP 5.6 / xdebug 2.3.2 machine at another location. I am behind a firewall, but I don't think that's the issue since I can connect by SSH with no problem, so the tunnel should work if I can just configure it correctly. I think the only issue is I am too dumb to figure out how to tunnel properly.</p>
  
  <p>How does the remote server's xdebug know to tunnel? Or does it need to know? Do I need to tell that server about the tunnel? Or is it already aware of it as soon as I connect via the tunnel? But if <em>is</em> aware, then why can't xdebug connect on port 9000? Does my PhpStorm listen on port 9000, and my PuTTY handle sending the data there? Or does PhpStorm need to listen on port 22?</p>
  
  <p><a href="https://confluence.jetbrains.com/display/PhpStorm/Remote+debugging+in+PhpStorm+via+SSH+tunnel" rel="nofollow noreferrer">This tutorial</a> I found that explains how to use PhpStorm with a remote server by SSH tunnel does not work (click to expand the section "Setting up an SSH tunnel on Windows). Xdebug on my remote testing server, the CentOS Linux machine where my PHP/MySQL based development website is sitting, cannot connect to my local Windows 8.1 development machine on port 9000.</p>
  
  <p>I don't fully understand tunneling, and maybe I never will, as I have spent several hours researching it and have yet to grasp it. I just want to debug my application. :(</p>
  
  <p>The tutorial instructs you to use Putty to open up an SSH connection to your remote server and configure the "tunnels" section of the connection to specify port 9000 on the remote host, and <code>localhost:9000</code> for your local development machine. I have done that, over and over again, but it seems that no one told my remote server what to do. </p>
  
  <p>Here are my putty settings:</p>
  
  <p><a href="https://i.stack.imgur.com/UjR3c.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UjR3c.png" alt="PuTTY configuration 1 (fake ip address)"></a>
  <a href="https://i.stack.imgur.com/zz4rd.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zz4rd.png" alt="PuTTY configuration 2 - the TUNNEL"></a></p>
  
  <p>The XDebug log keeps on showing that it failed to connect.</p>
  
  <pre><code>I: Checking remote connect back address.
  I: Remote address found, connecting to 173.12.34.123:9000.
  E: Time-out connecting to client. :-(
  Log closed at 2015-10-28 19:31:55
  </code></pre>
  
  <p>How can I tell if my remote XDebug is trying a direct connection to my server on port 9000, or if it is using the <code>tunnel</code> through port 22?</p>
  
  <p>Does it matter which user I connect as through SSH? <code>root</code> or some other user? Does it matter if I have another SSH session connected to the same server at the same time that is not tunneled?</p>
  
  <p>EDIT: Here are my xdebug settings as outputted by <code>phpinfo()</code>. They reflect the <code>php.ini</code> from my current website's root (<code>/home/testingsite/public_html/php.ini</code>).
  Note that the <code>xdebug.remote_log</code> is being saved in <code>/home/testingsite/public_html/var/xdebug/log.txt</code></p>
  
  <pre><code>xdebug
  
  xdebug support  enabled
  Version 2.3.2
  IDE Key PHPSTORM
  
  Supported protocols Revision
  DBGp - Common DeBuGger Protocol $Revision: 1.145 $
  
  Directive   Local Value Master Value
  xdebug.auto_trace   Off Off
  xdebug.cli_color    0   0
  xdebug.collect_assignments  Off Off
  xdebug.collect_includes On  On
  xdebug.collect_params   0   0
  xdebug.collect_return   Off Off
  xdebug.collect_vars Off Off
  xdebug.coverage_enable  On  On
  xdebug.default_enable   On  On
  xdebug.dump.COOKIE  no value    no value
  xdebug.dump.ENV no value    no value
  xdebug.dump.FILES   no value    no value
  xdebug.dump.GET no value    no value
  xdebug.dump.POST    no value    no value
  xdebug.dump.REQUEST no value    no value
  xdebug.dump.SERVER  no value    no value
  xdebug.dump.SESSION no value    no value
  xdebug.dump_globals On  On
  xdebug.dump_once    On  On
  xdebug.dump_undefined   Off Off
  xdebug.extended_info    On  On
  xdebug.file_link_format no value    no value
  xdebug.force_display_errors Off Off
  xdebug.force_error_reporting    0   0
  xdebug.halt_level   0   0
  xdebug.idekey   PHPSTORM    PHPSTORM
  xdebug.max_nesting_level    256 256
  xdebug.max_stack_frames -1  -1
  xdebug.overload_var_dump    On  On
  xdebug.profiler_aggregate   Off Off
  xdebug.profiler_append  Off Off
  xdebug.profiler_enable  On  On
  xdebug.profiler_enable_trigger  On  On
  xdebug.profiler_enable_trigger_value    no value    no value
  xdebug.profiler_output_dir  var/xdebug/profiles/    var/xdebug/profiles/
  xdebug.profiler_output_name cachegrind.out.%p   cachegrind.out.%p
  xdebug.remote_autostart Off Off
  xdebug.remote_connect_back  On  On
  xdebug.remote_cookie_expire_time    3600    3600
  xdebug.remote_enable    On  On
  xdebug.remote_handler   dbgp    dbgp
  xdebug.remote_host  localhost   localhost
  xdebug.remote_log   var/xdebug/log.txt  var/xdebug/log.txt
  xdebug.remote_mode  req req
  xdebug.remote_port  9000    9000
  xdebug.scream   Off Off
  xdebug.show_exception_trace Off Off
  xdebug.show_local_vars  On  On
  xdebug.show_mem_delta   Off Off
  xdebug.trace_enable_trigger Off Off
  xdebug.trace_enable_trigger_value   no value    no value
  xdebug.trace_format 0   0
  xdebug.trace_options    0   0
  xdebug.trace_output_dir /tmp    /tmp
  xdebug.trace_output_name    trace.%c    trace.%c
  xdebug.var_display_max_children 128 128
  xdebug.var_display_max_data 512 512
  xdebug.var_display_max_depth    3   3
  </code></pre>