Please help setting up remote debugging

Basically we have a server which has very few forward facing web interfaces, nothing but a select few queries can be run on it. but behind all of this is several processes running, grabbing messages from a queue and processing them via php functions etc, so it seems that all the guides for setting up phpstorm with Xdebug all seem to want to access via the browser, which doesnt seem doable for my situation. any idea how I can set this up?

thanks (and sorry if i have missed any info, its a whole new system im tryign to get my head around!)


Hi Michael,

Few ideas so far:
1) If you want to debug remotely -- expose those behind-the-scene scipts via web interface for testing/debugging. Such front-end script will pass all the parameters to the real-script ... and when you setup all path mappings propely (as those "real" scripts can be located in completely different place), you should be able to debug it.
2) If that is possible -- install and use PhpStorm on a server. In this case it will be "local" debugging. Obviously this will not work if you do not have GUI available on a server (console only).
3) Similar to #2 -- but replicate your whole server (or server environment) into Virtual Machine where you can have GUI (which means PhpStorm can be used "locally").
4) Maybe those scripts are not heavily dependant on server environment (or can be somehow configured) & can be run locally on your dev machine -- which means local debugging.


Hello michael,

I can suggest the following solution for your case(the solution is applicable for Xdebug only):

First you need to tune some php.ini setting related to Xdebug:

1) Enable xdebug.remote_autostart setting on your server -

2) Set xdebug.remote_host setting to you client machine

3) Set xdebug.remote_port setting to port on which PhpStorm will listen for connections(9000 usually)

Then you need to prepare your local environment for debugging:

4) Copy necessary sources to your local machine and set path mappings(see

5) Use 'PHP Remote Debug' run configuration(not sure that 'Listen' debug button will work, see -

Please let me know if this solution is not applicable for you.

Thank you for feedback!

thanks guys, will have a look into both of these solutions today and get back to you on how I get on!

thanks a lot



Did you try solutions?

Thank you for feedback!


Hi , yeah sorry for not replying, I was just getting round to trying some of the solutions to this and all of a sudden I ended up caught up in loads of database problems. somebody had created a very frequently used SQL query that uses several nested views locking every table and maxing out the server! grrrr. I will be coming back to this in the near future though and will definitly be updating this thread when the time comes

very sorry for not replying sooner!


FWIW, my biggest problem with getting x-debug to work is to make sure I have the xdebug.remote_host set to the exact ip address of my workstation.  Using 'localhost' and/or '' or even the workstation name doesn't always seem to work.  AND...if you get your ip via DHCP, then you may have to update your php.ini file.

Therefore, I'd suggest finding your ip address and then trying to set xdebug.remote_host="ip_address??" and restarting your server.  After you get it running, you may be able to work backwards and substitute the ip address with the workstation name or localhost or


Thanks for the reply, not too sure if ill be able to get an X desktop working on it as it is a amazon ec2 instance im trying to debug. I could try and create a local vm with almost identical setup, but im not 100% if ill be able to link it to simpledb or the sqs queues. also as were in an office I wont be able to give the exact IP of my workstation but i guess if i use the external IP and have a port forwarded to me specifically then that should work fine i imagine? or maybe some trickery via reverse proxy could achieve this?


Another issue is that most host providers block port 9000 which prevents remote debugging (I have this problem).  In some cases, you might be able to switch to another port if you update your php.ini file and the phpstorm setting for x-debug port.


Please sign in to leave a comment.