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

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.

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.

-- 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?

-- 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.

Yes, but for several reasons (like willing to change command line arguments very often, which is cumbersome from the launch box, but also because the integrated console is quite painful to clear or reset between each run), I like to launch the software from an external console (generally PuTTY, and possibly from another computer, virtual or not), include a DebugBreak() and debugging with PhpED starting from there.

How can I do this (in CLI mode) without getting a message like “New debug session with [any file].php has started. But IDE could not find the project for the web debugging. Breakpoints and other features may fail to work”?

How can I do this (in CLI mode) without getting a message like “New debug session with [any file].php has started. But IDE could not find the project for the web debugging. Breakpoints and other features may fail to work”?

You're getting this message because you don't have a project that matches the debug session parameters -- such as path, url, etc.
The easiest way to setup such project is to run Project Settings Wizard, like I said before.

How can I do this (in CLI mode) without getting a message like “New debug session with [any file].php has started. But IDE could not find the project for the web debugging. Breakpoints and other features may fail to work”?

You're getting this message because you don't have a project that matches the debug session parameters -- such as path, url, etc.
The easiest way to setup such project is to run Project Settings Wizard, like I said before.

I do have a project that matches the debug session parameters.

And I have run the Project Settings Wizard, and again, again, again, again, again, and again without any error.

But I must admit that this project doesn't match the debug session parameters about URLs.

On Windows with IP address xxx.xxx.xxx.xxx have PhpED running with the project open. That PhpED can save directly to the storage area (eg on Linux using Samba) if appropriate.

You can have PhpED breakpoints in the script but they won't activate until after the first DebugBreak.

In the PHP CLI script use DebugBreak('1@xxx.xxx.xxx.xxx');

When the script runs (eg on Linux), it will hit the DebugBreak, the PHP debugger will contact the debug listener on the Windows computer and that will then activate PhpED. When you continue running (or single step) the script from PhpED, it will then be able to send the other breakpoints to the PHP debugger.

OMG, PhpED supports remote projects for 10 years now. Why don't you just try that? You don't need any DebugBreak(s), you don't need any Sambas, you don't need any dances with permissions and hardlinks.

Gingko wrote:

And I have run the Project Settings Wizard, and again, again, again, again, again, and again without any error.

Getting it passed without errors is not a goal. The goal is to run it in the project besides your files, then save the results discovered by the IDE in the process.
If after that you still get error like "new debug session started and project not found", please post all details here (or upgrade to PRO version and contact support)