NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
Debugging requests from one host to another


Joined: 10 Sep 2013
Posts: 9
Reply with quote
On my local PC I have Nusphere PhpEd installed and also I have two similar VirtualBox VMs with installed DBG plugin. Both VMs contain Apache with PHP Web applications.

I configured remote debugging successfully so I can put debugbreak() in the code on VM1 and when I open it in browser it starts debugger in the PhpEd successfully. I can do the same when I run requests to the VM2.

Now the trick is that I have some requests to Webapp on VM1 and it then does HTTP requests to Webapp on VM2 on its own (using Guzzle).

Can I somehow configure the debugger so that I can put debugbreak() in the webapp on VM2 and it will start the debugger on my host machine? The problem is that VM2 doesn't know where my Nusphere is installed, it sees the client ip as the ip of VM1.

There is a "debugger.ports=7869" configuration but is there "debugger.host" or something like this?

Host and VMs can access each other and have Ips like.
192.168.56.1 - host
192.168.56.5 - VM1
192.168.56.6 - VM2

So they are all in the same virtual network.
View user's profileFind all posts by ruslanbesSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 7835
Reply with quote
your script on VM1 that sends HTTP requests to VM2 should also send DBGSESSID http GET, POST or COOKIE variable that it got from the IDE. So if you start debugging VM1, you'll transparently switch to debugging script on VM2.

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


Joined: 10 Sep 2013
Posts: 9
Reply with quote
Shouldn't I also create portforward of the default debugger port (7869) from VM1 to my host PC?

I tested the setup as you suggested - my VM1 script looks for the value
Code:
$_COOKIE['DBGSESSID']
and sends it to the VM2 also as a cookie with the same name. Its value is
Code:
1;d=1,p=0

I also changed the dbg.ini value on VM2 to
Code:
debugger.hosts_allow=ALL

that fixed the hosts restriction.

Currently my case is following - VM1 script starts debugging, gets to the point where it sends HTTP request to VM2 and hangs there. I suspect VM2 looks for the debugger client but can't find it. Or I'm missing something here.

Setup:
Host PC: Windows x64, Nusphere 17.0
VM1 and VM2 both: Linux 14x64
VM1's PHP: 5.6
VM2's PHP: 5.4

Separately they both work like charm.
View user's profileFind all posts by ruslanbesSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 7835
Reply with quote
Quote:
1;d=1,p=0
-- it's not entirely correct. Should be 1@ipaddresshere:porthere;d=1,p=0
What you have may work on local machine, but I can't imagine how debugger on VM1 or VM2 would find the IDE.
Do you have sort of filters in HTTP? May be they recognize "@ipaddresshere:porthere" as http username/password and strip them?

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


Joined: 10 Sep 2013
Posts: 9
Reply with quote
dmitri wrote:
Quote:
1;d=1,p=0
-- it's not entirely correct. Should be 1@ipaddresshere:porthere;d=1,p=0
What you have may work on local machine, but I can't imagine how debugger on VM1 or VM2 would find the IDE.
Do you have sort of filters in HTTP? May be they recognize "@ipaddresshere:porthere" as http username/password and strip them?


Passing "@ip:port" worked. Thanks! That was my mistake.

The thing is most of the time I work normally and just put debugbreaks around the code and press F5 in browser - so DBG session starts when it encounters one. In this case I either have no DBGSESSION or DBGSESSION=-1. I guess in my case debugger simply looked at the client ip address and assumed it by default.

I tried to build DBGSESSION manually and didn't included ip address - that was my problem.
View user's profileFind all posts by ruslanbesSend private message
Debugging requests from one host to another
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