Debugging local server HTTP Requests from standalone Client Application

Hi - Help! I'm a bit stuck working out how to do this. I have a XAMPP setup locally and it's all working very nicely with xdebug enabled etc

So I have a bunch of PHP pages there which get called by a standalone compiled client application (of which I do not have control/the source), it makes POST requests to the PHP code on my server which sends back XML. As this process is not behaving as I would wish I would like to step into the PHP/apache parts of the process and work out why and ideally fix it. I cannot work out a) if this is possible in PHPStorm and b) if so, how I set it up so that he debugger can get involved in managing apache's response to when the client application decides to poll a request by making a new POST.

I have considered setting up another PHP page to try to mimic the client application's calls but am not sure this will work out yet and I'd much rather be able to debug as a "man in the middle" if at all possible.

Can anyone confirm if it is possible to do this and if so, how?


Comment actions Permalink

Hi there,

If I correctly understand whole situation: Yes.

1) Since you cannot force your own cookie or GET/POST parameter with xdebug marker .. you will have to configure IDE to attempt to debug every single request (even if it's not related/from another app, so better do this on server with limited requests). This can be achieved with "xdebug.remote_autostart = 1" option in your php.ini

2) You can simulate lots of different requests using "Tools | Test RESTful Web Service" from inside PhpStorm. In such case you can add that special xdebug cookie or GET/POST param yourself (so no need for #1). If specific request cannot be sent using that tool (e.g. POST with query parameters) then you could use any other tools, e.g. something like Postman for Chrome

If everything configured correctly it's definitely possible -- did it myself one time.

Just in case:

In PhpStorm, you will have to have all source code available under project + use "phone handle" icon activated to start listening for PHP debug connections (check "Zero-config" article from the link above).

Comment actions Permalink

Brilliant! Thanks Andriy


Please sign in to leave a comment.