【转】Connecting Zend Studio to Zend Debugger over an SSH Tunnel

26 篇文章 0 订阅
20 篇文章 0 订阅

      之前在Zend Studio 9中使用Zend Debugger进行远程调试时遇到一些问题,在Google时,

找到了下面这篇文章,是对SSH Tunnel连接Zend Debugger的介绍,很有用处.在此转贴.

      Connecting Zend Studio to Zend Debugger over an SSH Tunnel

 

This article applies to:

 

[ Zend Studio 7.x, Zend Studio for Eclipse 6.x ]
[ All operating systems ]


Overview

Normally, Zend Studio initiates the remote debugging session by sending a regular HTTP request to the debug server. This HTTP request contains return address parameters (IP address and port number) that the Zend Debugger uses when starting a new connection to Zend Studio in order to relay debugging information.

Regular debug session

In many environments, it may be the case that the debugging session is prevented by some network obstacles (firewalls, routers, proxy servers, etc.). To allow safe and effective bypassing of network obstructions you can setup an SSH Tunnel for remote debugging with Zend Studio. In this case, the process of establishing the debug session consists of two major steps:

  • Creating an SSH Tunnel
  • Instructing Zend Debugger to relay its traffic through the SSH Tunnel

To setup an SSH Tunnel you need first to tell the SSH daemon to open a listening port on the server and forward the traffic from this port to the port on your workstation, where Zend Studio is listening. Once this is done you need to instruct Zend Debugger to send the debug information not to the Zend Studio workstation directly, but through the created tunnel.

Debug session trough the SSH Tunnel

Note
Since Zend Studio opens the listening port 10137 for establishing the debug sessions by default, we use this port number in our examples. If for some reason you are using a different port, make the necessary changes to adapt our instructions to your situation.

Instructions

Creating an SSH Tunnel

To create an SSH Tunnel from a Linux and Mac OS X workstation use this command template:
ssh <Zend Studio listening port>:127.0.0.1:<port to open on the debug server> <user>@<debug server address>

For example:

user@workstation:~> ssh -R 10137:127.0.0.1:10137 user@debugserver
user@debugserver's password: <enter user's password on the debug server>
Welcome to the Debug Server!

user@debugserver:~$

To create an SSH Tunnel from a Microsoft Windows workstation, you can use PuTTY. Run the program and configure it as described below:

  1. From the Category list choose Connection | SSH | Tunnels.
    This will display the Options controlling SSH port forwarding page.
  2. In the Source port field enter "10137".
  3. In the Destination field enter "127.0.0.1:10137".
  4. From the options below select Remote.
  5. Click Add.
    This will add the configuration to the Forwarde ports list.

  1. From the Category list choose Session.
    This will display the Basic options for your PuTTY session page.
  2. In the Host Name field enter the name or the IP address of the debug server (you may use the "user@host" notation as well).
  3. In the Saved Sessions field enter a descriptive name.
  4. Click Save.
    This will add the newly configured session to the Saved Sessions list where you can easily re-use it.

  1. Click Open to create the SSH Tunnel connection to the debug server.
  2. Enter the user name and password at relevant prompts.
login as: user
Using keyboard-interactive authentication.
Password: <enter user's password on the debug server>
Welcome to the Debug Server!

user@debugserver:~$

Instructing Zend Debugger to Relay Its Traffic Through the SSH Tunnel

  1. In Zend Studio go to Window | Preferences.
    This opens the Preferences page.
  2. Navigate to the page PHP | Debug | Installed Debuggers.
  3. Select Zend Debugger and click Configure.
    This opens the Zend Debugger configuration dialog.
  4. Verify that the field Client Host/IP contains the loopback address 127.0.0.1.

Note
If you are planning to debug your applications only via the SSH Tunnel, it is recommended to remove all IP addresses except the loopback address 127.0.0.1 in the Client Host/IP field. This may significantly improve the performance of the debug session.

Result

You should be able to verify that the SSH Tunnel is open in the remote shell session after the connection. Issue the following command to see that the SSH deamon is listening on the local port 10137:

user@debugserver:~$ netstat -tln | grep :10137
tcp        0      0 127.0.0.1:10137         0.0.0.0:*               LISTEN
tcp6       0      0 ::1:10137               :::*                    LISTEN

The ultimate proof that your setup is correct is the possibility to start and conduct a remote debugging session.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值