NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
Make virtualized PhpED's DBG work with host browser
Veteran

Joined: 26 Dec 2006
Posts: 253
Location: Phoenix, AZ
Reply with quote
Hi all,

With the recent push by NuSphere and Parallels to virtualize PhpED, I'm hoping someone has already been down this road.

I have PhpED running under Win XP in a VMware machine on a Mac running Leopard. Within the VM, I can easily enough set up an SSH tunnel to the server to enable the debugger, and it works fine with browsers in the VM. What I want to do, however, is use a browser on the Mac side, but have the debugger traffic routed to PhpED on the Windows side. In affect, this is like splitting the debugging across two machines, one for the browser and one for the actual debugger.

Is this possible somehow? Any ideas? I've thought about setting up a second tunnel on the Mac side, but I obviously can't use the same ports since they'll already be taken on the server. Can I use a different port, but route the traffic on the Mac end to port 7869 on the VM? Will this confuse the debugger? How would I configure it?

Any and all tips greatly appreciated.
View user's profileFind all posts by bobwilliamsSend private messageVisit poster's website
Site Admin

Joined: 13 Jul 2003
Posts: 8334
Reply with quote
there are two possible cases:
1)You run Apache under VmWare.
In this case, depending on the VMWare network settings, you can access to Apache either through VMWare NAT'd, or bridged, or shared adapter. In other words, no special actions are required to access Apache in the vm, except firewall rules. Once you get an access, you can run debugger by adding DBGSESSID (see FAQ on how to run debug sessions), feel free to add scriplets in the browser to simplify the process (I'm not sure if safari supports them).

2) You run Apache under Mac. It's a bit harder, but still possible. "Host only" setting for the network won't work because in this case vm won't see your host network, only host will see it. You need either bridge or NAT. In both cases software under VM will see your Apache in the host and therefore it's not hard to spcify URL in the project settings and so forth.

Let know what particular problems urged you to use ssh tunneling in such a trivial environment? Smile (I know, networks settings aren't that trivial but anyway?)

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website
Veteran

Joined: 26 Dec 2006
Posts: 253
Location: Phoenix, AZ
Reply with quote
dmitri wrote:
there are two possible cases:
Let know what particular problems urged you to use ssh tunneling in such a trivial environment? Smile (I know, networks settings aren't that trivial but anyway?)


I don't think I made myself clear, as this isn't quite that trivial Smile. Perhaps a diagram would be more helpful....



The web server resides on Server B, which I can only get to via SSH through Server A. From the VM, with it in bridge mode, I can use the debugger by creating a double remote tunnel. However, I want to access the web site from a browser on the Mac side, but still have the debugger talk to PhpED inside the VM. I was thinking I might be able to do this by setting up the dual tunnel for DBG on the Mac side, and then use its firewall to forward packets coming in on 7869 to the VM's IP address. Will this work? Is there an easier way?
View user's profileFind all posts by bobwilliamsSend private messageVisit poster's website
Site Admin

Joined: 13 Jul 2003
Posts: 8334
Reply with quote
Well, you can forward mac's TCP/80 port to the web using one tunnel.
user@mac# ssh -L<macip>:80:<webip>:80
if you need 80th on the vm, you can do this either through another tunnel:
user@vm# ssh -L<vmip>:80:<webip>:80
or work with mac's tunnelled TCP/80 directly:
(it means use mac's bridged ip in the URL when you invoke it on the VM)
Regarding debugger, you'd need tunnel that will forward web's 7869/TCP to your vm.:
user@vm# ssh -R<vmip>:7869:<webip>:7869

I'm not sure why would you need "double-tunnels".

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website
Veteran

Joined: 26 Dec 2006
Posts: 253
Location: Phoenix, AZ
Reply with quote
It started working when I turned off the custom port debugger option in PhpED. Which doesn't make a lot of sense to me, but there you go.

So here's the setup I ended up with. All I need to do to get DBG working as I want is this in XP (well, an equivalent of this using SecureCRT, since XP lacks SSH):

% ssh PublicBox -R 7869:localhost:7869 ssh PrivateBox -R 7869:localhost:7869

Then when I connect to the site using a browser on the Mac side (working through a tunnel established on the Mac side for the HTTP traffic), the debugger requests go to XP as desired. Yea!

When I want to use a browser on the XP side, with the same tunnels set up, I needed to have the custom port debugger setting turned on. But using a browser on the Mac side didn't work until I turned it off. <shrug>

If you know a way to accomplish this in a way that will only do encryption once, that'd be great. I think I could use port forwarding in the firewall, but that's not an option on the PublicBox machine.
View user's profileFind all posts by bobwilliamsSend private messageVisit poster's website
Site Admin

Joined: 13 Jul 2003
Posts: 8334
Reply with quote
Quote:
% ssh PublicBox -R 7869:localhost:7869 ssh PrivateBox -R 7869:localhost:7869

I'm not sure which is what.Is PublicBox Mac? Is PrivateBox your site? or what?

Quote:
When I want to use a browser on the XP side, with the same tunnels set up, I needed to have the custom port debugger setting turned on. But using a browser on the Mac side didn't work until I turned it off.

You don't need to change debugger settings, they would be all the same while working with this site, regardless you run browser under Mac or XP.
On the Mac site, you need to specify DBGSESSID in the browser url. It should contain localhost to make debugger on the site connecting to the local tunnel point (for example DBGSESSID=1@127.0.0.1:7869)
On the XP side, custom host/port for the debugger play their role (you'd have the same 127.0.0.1 7869 there) and it will form appropriate DBGSESSID for you in the browser URL.

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website
Veteran

Joined: 26 Dec 2006
Posts: 253
Location: Phoenix, AZ
Reply with quote
dmitri wrote:
Quote:
% ssh PublicBox -R 7869:localhost:7869 ssh PrivateBox -R 7869:localhost:7869

I'm not sure which is what.Is PublicBox Mac? Is PrivateBox your site? or what?


PublicBox is the server in front of the firewall; PrivateBox is the server behind the firewall. PrivateBox is the one with the web server, so to get to it, I have to ssh from the Mac to PublicBox, and then from PublicBox to PrivateBox.

Quote:
You don't need to change debugger settings, they would be all the same while working with this site, regardless you run browser under Mac or XP.
On the Mac site, you need to specify DBGSESSID in the browser url. It should contain localhost to make debugger on the site connecting to the local tunnel point (for example DBGSESSID=1@127.0.0.1:7869)


I think that last part may have played a role in the confusion... I didn't realize how that worked. Though, I'm still not completely clear why it started working with I turned off the custom host/port setting in PhpED.
View user's profileFind all posts by bobwilliamsSend private messageVisit poster's website
Site Admin

Joined: 13 Jul 2003
Posts: 8334
Reply with quote
Quote:
why it started working with I turned off the custom host/port setting in PhpED

from the web perspectives you're connecting to it from localhost point (it's sshd does this for you because of tunnel) and therefore debugger connects back at the "client" address (which is localhost) on 7869/TCP port and this is fine.

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website
Make virtualized PhpED's DBG work with host browser
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic