在以下 IP 下,我的容器在我的 Web 浏览器中运行成功
我还创建了一个卷来在我的容器和我的文件系统之间共享文件
docker run --name lampf -d -p 32775:80 -v /Users/sja/Sites/lamkepf2:/var/www/html --link=lampf_db:db codinglimo/apache_php540_gs_imgmck_pdflib9
现在我在我的容器中也成功安装了 xDebug,并带有以下 xdebug.ini
zend_extension="/usr/local/lib/php/extensions/no-debug-non-zts-20100525/xdebug.so"
xdebug.remote_enable=on
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.profiler_enable=0
xdebug.profiler_output_dir="/temp/profiledir"
PHPStorm 也配置好了
http://img2.picload.org/image/iowdpww/xdebug.png
但是我的 index.php 中的断点被忽略了吗? 我的错误是什么?
问题在 Sergey 的帮助下得以解决
我的新 xdebug.ini
zend_extension="/usr/local/lib/php/extensions/no-debug-non-zts-20100525/xdebug.so"
xdebug.remote_enable=on
#xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.remote_connect_back=On
xdebug.remote_handler=dbgp
xdebug.profiler_enable=0
xdebug.profiler_output_dir="/temp/profiledir"
最佳答案
您的 Docker 容器无法看到 IP 为 127.0.0.1 的 PHP Storm IDE,通常主机是容器内的 172.17.42.1。 remote_connect_back 也可能无法正常工作。尝试这样设置:
xdebug.remote_host=172.17.42.1
xdebug.remote_connect_back=Off
您可能需要寻找一种正确的方法来了解容器中主机的 IP,172.17.42.1 只是默认值,但可能并不总是这样。
关于php - 如何使用 phpStorm 调试我的 docker 容器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30668090/