我在Docker中很新。我无法将Docker容器上的xdebug连接到PhpStorm IDE。
我花了很多时间来搜索如何解决负面结果。 我很确定我尝试了我发现的所有内容并提供了更多解决方案。
我知道这里有很多文字,但我希望有人能得到它:D
我的PhpStorm是v 8.0.3
我实际的docker-compose snip:
ports:
- "8081:8081"
- "80:80"
- "443:443"
expose:
- "9001"
links:
- magedb_m1
environment:
XDEBUG_CONFIG: "remote_host=172.17.0.1"
PHP_IDE_CONFIG: "serverName=docker"
XDEBUG_CONFIG: "idekey=PHPSTORM"
PHP_XDEBUG_ENABLED: 1
volumes:
- ./project/:/var/www/html/
xdebug.ini:
[xdebug]
zend_extension=xdebug.so
xdebug.idkey = "PHPSTORM"
xdebug.default_enable=1
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
; This is the default Docker gateway
xdebug.remote_host=172.17.0.1
xdebug.remote_port=9001
xdebug.remote_autostart=1
xdebug.remote_connect_back=0
PhpStorm PHP设置:
http://img.ctrlv.in/img/16/10/02/57f0d57039ac8.png
来自我当地的IP:
1: lo: mtu 65536 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: enp4s0f1: mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 14:dd:a9:0b:ee:74 brd ff:ff:ff:ff:ff:ff
inet 192.168.2.104/24 brd 192.168.2.255 scope global dynamic enp4s0f1
valid_lft 315356022sec preferred_lft 315356022sec
inet6 fe80::16dd:a9ff:fe0b:ee74/64 scope link
valid_lft forever preferred_lft forever
3: virbr0: mtu 1500 qdisc noqueue state DOWN
link/ether 52:54:00:d5:ef:9c brd ff:ff:ff:ff:ff:ff
inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
valid_lft forever preferred_lft forever
4: virbr0-nic: mtu 1500 qdisc pfifo_fast master virbr0 state DOWN qlen 500
link/ether 52:54:00:d5:ef:9c brd ff:ff:ff:ff:ff:ff
5: docker0: mtu 1500 qdisc noqueue state UP
link/ether 02:42:b4:ad:cc:ab brd ff:ff:ff:ff:ff:ff
inet 172.17.0.1/16 scope global docker0
valid_lft forever preferred_lft forever
inet6 fe80::42:b4ff:fead:ccab/64 scope link
valid_lft forever preferred_lft forever
6: br-c2e824564ce6: mtu 1500 qdisc noqueue state DOWN
link/ether 02:42:44:61:39:53 brd ff:ff:ff:ff:ff:ff
inet 172.18.0.1/16 scope global br-c2e824564ce6
valid_lft forever preferred_lft forever
34: veth29f09f2@if33: mtu 1500 qdisc noqueue master docker0 state UP
link/ether da:96:0c:3e:78:bd brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet6 fe80::d896:cff:fe3e:78bd/64 scope link
valid_lft forever preferred_lft forever
36: vethddad676@if35: mtu 1500 qdisc noqueue master docker0 state UP
link/ether 2e:26:7c:1b:7c:0b brd ff:ff:ff:ff:ff:ff link-netnsid 1
inet6 fe80::2c26:7cff:fe1b:7c0b/64 scope link
valid_lft forever preferred_lft forever
带有xdebug的容器中的IP
1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
35: eth0@if36: mtu 1500 qdisc noqueue state UP group default
link/ether 02:42:ac:11:00:03 brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet 172.17.0.3/16 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::42:acff:fe11:3/64 scope link
valid_lft forever preferred_lft forever
容器xdebug.ini存在于:
etc/php/5.6/mods-available/xdebug.ini
我尝试了不同的远程主机地址(172.17.0.3 / 172.17.0.2 / 172.17.41.1 /更多)。不同的xdebug.ini选项
你能给我一个如何解决的提示吗?