当docker搭建好了环境 然而容器与宿主机之间处于不同网段导致xdebug配置起来就要使用远程断点法了
docker容器部署 xdebug扩张安装请参见
远程断点图解
![](https://img.haomeiwen.com/i32778/1e4c1b3c57d41721.gif)
1.首先配置
[XDebug]
xdebug.enable=1
;开启远程调试
xdebug.remote_enable=1
xdebug.idekey=PHPSTORM
;宿主机ip (docker從18.03開始建議連接到特殊DNS名稱host.docker.internal)
xdebug.remote_host=host.docker.internal
;确定宿主机内此断口没有被占用
xdebug.remote_port=19000
2.配置IDE
![](https://img.haomeiwen.com/i14896941/786bd5f4d9982bd8.png)
开启监听
![](https://img.haomeiwen.com/i32778/f875c36e99e42fce.png)
此时可以运行一下命令,查看端口是否被监听
![](https://img.haomeiwen.com/i14896941/ff040e5364c2b8fc.png)
配置debug服务
![](https://img.haomeiwen.com/i14896941/e5712c9224f6250f.png)
![](https://img.haomeiwen.com/i14896941/4432ebec82aee62c.png)
3.开始断点
安装浏览器插件。xdebug helper
![](https://img.haomeiwen.com/i32778/dbae539e88f7ef65.png)
![](https://img.haomeiwen.com/i32778/f6aa65fa10269a2c.png)
完成最后断口测试
![](https://img.haomeiwen.com/i14896941/a5adf25f1df39680.png)
网友评论