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

问题描述:

我在尝试让Xdebug与Docker一起在PhpStorm中工作时遇到问题。带有Docker + xdebug的PhpStorm不会在断点处停止

这里是我的XDebug配置:

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 

我的搬运工,撰写:

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: 

我已经配置我的PhpStorm如下:

PhpStorm xdebug setting

远程调试配置:

Remote config

当我开始调试,我只看到“等待与IDE键‘PHPSTORM’传入的连接”,并指出!我还需要配置什么?我在Ubuntu 16.04

Xdebug的日志运行PhpStorm 2017.2:

<- 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> 
+0

xdebug对此有何评论? – LazyOne

+0

@LazyOne根据日志,它似乎在运行,但不会停在断点处。这里是我的xdeug日志的输出: – ojoma

+0

那很麻烦:你不能在PhpStorm中看到“Waiting ...”消息,并且有一个xdebug日志,它实际上设置了断点。一旦IDE收到调试连接,它将不会显示“等待”消息。如果这是一个干净的运行(不是来自其他容器或其他任何东西) - 从IDE端收集额外的日志 - 它应该告诉从IDE中发生的事情:https://intellij-support.jetbrains.com/hc/en -us/articles/207241115-How-to-Collecting-PhpStorm-WebStorm-debug-Logs – LazyOne

对于具有类似问题的任何一个,下面的链接Xdebug with phpstorm and Docker将帮助您配置了XDebug与PHPStorm。我不得不改变: xdebug.remote_connect_back=0xdebug.remote_connect_back=1xdebug.remote_host=???是你的主机的IP地址。

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