带有Docker + xdebug的PhpStorm不会停止在断点上

我在尝试让Xdebug与Docker一起在PhpStorm中工作时遇到了问题。

这是我的xdebugconfiguration:

zend_extension=xdebug.so xdebug.default_enable=1 xdebug.remote_enable=1 xdebug.remote_handler=dbgp xdebug.remote_port=9000 xdebug.remote_autostart=1 xdebug.remote_connect_back=1 xdebug.idekey="PHPSTORM" xdebug.remote_host=192.168.0.27 

我的docker – 撰写:

 version: '2.0' services:db: image: mysql:5.5 container_name: mysql5 volumes: - "/home/xxx/docker_projects/mysql55_storage:/var/lib/mysql" ports: - "3355:3306" restart: always environment: MYSQL_ROOT_PASSWORD: pass php510: build: /home/xxx/docker_projects/php510 container_name: php510 ports: - "5510:80" volumes: - "/home/xxx/www/docker_stuff/hrm32:/app" - "/home/xxx/docker_projects/xdebug:/etc/php5/fpm/conf.d/20-xdebug.ini" depends_on: - db links: - db restart: always phpmyadmin: depends_on: - db image: phpmyadmin/phpmyadmin:latest container_name: phpmyadmin2 links: - db ports: 

我已经configuration我的PhpStorm如下:

PhpStorm的xdebug设置

远程debuggingconfiguration:

远程配置

当我开始debugging时,我只看到“等待与ide键”PHPSTORM“的传入连接,并注意! 我还需要configuration什么? 我在Ubuntu 16.04上运行PhpStorm 2017.2

Xdebug日志:

 <- breakpoint_set -i 20 -t line -f file:///app/application/modules/default/forms/employee.php -n 519 -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="20" id="1240039"></response> <- stack_get -i 21 -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="stack_get" transaction_id="21"><stack where="{main}" level="0" type="file" filename="file:///app/index.php" lineno="21"></stack></response> <- run -i 22 -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="run" transaction_id="22" status="stopping" reason="ok"></response> 

对于任何有类似问题的人,下面的链接Xdebug与phpstorm和Docker将帮助你configurationPHPStorm xdebug。 我不得不改变: xdebug.remote_connect_back=0xdebug.remote_connect_back=1xdebug.remote_host=??? 是你的主机的IP地址。

如果configuration没问题,确保每个实例只有一个IDEconfiguration为使用xdebug作为应用程序。 我注意到,这是我的问题的原因。 我现在模拟了它多次,这是相同的结果。