[英]PHPStorm, Docker and debugging
I'm trying to debug php code with PHPStorm. 我正在尝试使用PHPStorm调试php代码。 I'm on a Mac with docker.
我在使用docker的Mac上。 I configured xdebug on docker using:
我在docker上使用以下命令配置了xdebug:
zend_extension="/usr/local/lib/php/extensions/no-debug-non-zts-20151012/xdebug.so"
xdebug.remote_enable = 1
xdebug.remote_connect_back=1
xdebug.idekey = "PHPSTORM"
Then I open the listening on PHPStorm, set the cookie in the browser and then load a page setting a break point in the corresponding point. 然后,我在PHPStorm上打开侦听,在浏览器中设置cookie,然后加载一个页面,在相应的位置设置一个断点。 It happens that, PHPStorm detect an incoming connection, and asks me to accept the connection.
碰巧,PHPStorm检测到传入连接,并要求我接受该连接。 I click on accept, the debug fills with the variables and after 1 second, the connection stops and the debugging session ends.
我单击接受,调试将充满变量,并在1秒钟后,连接停止,调试会话结束。
What am I doing wrong? 我究竟做错了什么?
I was not able to get xdebug.remote_connect_back=1
to work for me. 我无法让
xdebug.remote_connect_back=1
为我工作。
Instead, you need to provide the IP address of the docker host. 相反,您需要提供Docker主机的IP地址。 Since the docker 18.03 release, you can reference the
host.docker.internal
DNS entry from within running docker containers. 从
host.docker.internal
18.03版本开始,您可以从正在运行的host.docker.internal
容器中引用host.docker.internal
DNS条目。
You should try the following: 您应该尝试以下方法:
xdebug.remote_connect_back=1
line. xdebug.remote_connect_back=1
行。 The default value is 0. xdebug.remote_host=host.docker.internal
xdebug.remote_host=host.docker.internal
The rest of your steps sound correct. 您的其余步骤听起来都是正确的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.