之前在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
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@debugserver's password: <enter user's password on 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:
- From the Category list choose Connection | SSH | Tunnels.
This will display the Options controlling SSH port forwarding page. - In the Source port field enter "10137".
- In the Destination field enter "127.0.0.1:10137".
- From the options below select Remote.
- Click Add.
This will add the configuration to the Forwarde ports list.
- From the Category list choose Session.
This will display the Basic options for your PuTTY session page. - 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).
- In the Saved Sessions field enter a descriptive name.
- Click Save.
This will add the newly configured session to the Saved Sessions list where you can easily re-use it.
- Click Open to create the SSH Tunnel connection to the debug server.
- Enter the user name and password at relevant prompts.
Using keyboard-interactive authentication.
Password: <enter user's password on the debug server>
user@debugserver:~$
Instructing Zend Debugger to Relay Its Traffic Through the SSH Tunnel
- In Zend Studio go to Window | Preferences.
This opens the Preferences page. - Navigate to the page PHP | Debug | Installed Debuggers.
- Select Zend Debugger and click Configure.
This opens the Zend Debugger configuration dialog. - Verify that the field Client Host/IP contains the loopback address 127.0.0.1.
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:
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.