2017-08-10 120 views
0

我在嘗試讓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

回答

0

對於具有類似問題的任何一個,下面的鏈接Xdebug with phpstorm and Docker將幫助您配置了XDebug與PHPStorm。我不得不改變: xdebug.remote_connect_back=0xdebug.remote_connect_back=1xdebug.remote_host=???是你的主機的IP地址。

如果配置沒問題,請確保只有一個IDE配置爲每個實例的應用程序使用xdebug。我注意到,這是我的問題的原因。我現在模擬了它多次,這是相同的結果。