remote debug with multiple projects



I have a PHP MVC website (, which calls my PHP API ( using a cURL call, and I am having trouble debugging between them.

Both are hosted on the same remote server, in separate phpstorm projects, using one virtual-host file with an "Alias" entry.

My php.ini xdebug entry looks like this:

And my .bashrc contains the following:
export PHP_IDE_CONFIG="serverName=myservername"

What I know so far:

-Hitting the "Debug ''" button will listen for incoming connections for a given IDE key (e.g. 'PHPSTORM'),

-Whereas hitting the "start listening for php debug connections" button will listen for ALL connections

What I do not know:

-I open two PhpStorm windows (one per project). If I try to hit the "Debug" button in both, I get the error "handler with the same session id is already registered". Am I mean to have different IDE keys? If so, how, because right now the IDE key is set in my php config file, and not on a per-project basis.

-If instead of debugging I "start listening for php debug connections" in both projects, the first call is caught and it debugs correctly. But when the cURL call is made the second project does not debug.

I read the following articles but they did not really help:

The first article would suggest that I need to pass a bunch of GET parameters with every request in order to trigger debugging. This is not an ideal solution for several reasons (maintenance, production).

Is there a "standard" procedure for debugging multiple (but related) projects on a remote server? For example, can I set multiple IDE keys on a single server?

If this is possible I will be able to subdivide my app into many microservices, which will be amazing.



Thanks Dimitry.

I have it working to an extent. I can have multiple ide-keys by setting the ide-key inside my htaccess files, instead of php.ini. So I have one ide-key per project. This allows me to debug project1, curl call project2, and then debug project2. This on it's own is pretty great.

As Mark mentions in (, calls are slow, but it works.

However, if I want the curl call to synchronously return data to project1, this is not possible. I guess because:

1) the first hit to project1 is a legitimate HTTP request

2) the curl call to project2 is also a legitimate request

3) but the return from the curl call is not a web request

If I can get that last piece working then my dream of debugging microservices will become a reality.

Any advice is appreciated.



ok, I have it! I was just missing this piece, as was mentioned in the other post:

  • Set "Max. simultaneous connections" to something greater than one in "Settings->PHP->Debug"

I can now debug multiple php projects. This is too awesome.

And if you have a CLI script you can do the same, but you need to set the "DBGP_IDEKEY" environment variable first, e.g.



Vladimir Luchansky

Thank you for the contribution!


Please sign in to leave a comment.