Docker / Xdebug Over LAN Server Multiple Developer

2019-08-30 02:03发布

问题:

I'm attempting to setup Xdebug on some containers we have at the office. We have a Ubuntu server running Docker with the firewall wide open over LAN.

Ideally each developer would like to use PhpStorm (which we work over a mounted samba drive), to debug code on various websites.

We use Apache and have the jwilder nginx proxy to server multiple sites in docker.

I've attempted to setup a DBGp proxy with no luck so far. php.ini looks like this:

xdebug.remote_enable=1
xdebug.remote_host=containername
xdebug.remote_port=9001
xdebug.remote_handler=dbgp
xdebug.remote_mode=req

Inside the container for the DBGp proxy I have it on the same network as Apache and bind the 9001 externally e.g. - "9012:9001"

Using the IDE It does appear to detect the DBGp proxy correctly in PhpStorm. I listen for connections and place the IDE key in the get variable to start Xdebug session. I've tried with the Zend Debugger extension as well. At this point no break points are hit and the script just continues.

Do I need to do anything in PhpStorm to tell PhpStorm that the file directory doesn't match the directory on the server? Am I missing something in the php.ini file.

In this scenario could I simply use remote connect back for multiple developers and get rid of DBGg? Would it pose a security risk if the port was blocked via UFW on the docker host to the external world (I presume at the very least everyone could trigger Xdebug as these development sites are exposed to the world per say)?

回答1:

hard to tell what's wrong and how to solve it at this point. did you try to break at the first line of code (run->break at first line)? if this does not stop your debug connection is not established. also try xdebug.remote_connect_back instead of defining the remote host