docker - Xdebug:在将IDE最小化几分钟后,脚本恢复在后台自动运行

标签 docker phpstorm xdebug

我在装有OSX 10.15.6的Mac上的Docker 2.3.0.3(45519)上使用PhpStorm 2020.1.4和Xdebug 2.6.1

  • 我在代码中设置了一个断点,调试器按预期在此处停止。
  • 我把浏览器放在前面,检查了几分钟。
  • 我回到PhpStorm。

  • 调试已停止,但脚本仍在运行。我知道这一点,因为我可以看到数据库中发生了更改。
    我希望我可以回到PhpStorm,并且调试器仍然卡在与将浏览器(或任何其他程序)放在前面相同的断点处。
    有人知道如何存档吗?
    这是我的Xdebug配置:
    [xdebug]
    zend_extension="/usr/lib64/php/modules/xdebug.so"
    
    xdebug.remote_host=host.docker.internal
    xdebug.remote_enable=1
    xdebug.remote_port=9000
    xdebug.remote_handler=dbgp
    xdebug.remote_autostart=1
    xdebug.remote_connect_back=0
    
    xdebug.profiler_enable_trigger=1
    xdebug.profiler_enable=0
    xdebug.profiler_output_dir=/var/www/vhosts/my-site/logs/profiler
    xdebug.profiler_output_name=%R
    

    最佳答案

    因此,它是Mac和Docker容器。
    这似乎是由于Docker丢弃了空闲的TCP连接。修改~/Library/Group Containers/group.com.docker/settings.json并更改vpnKitPortMaxIdleTime的值应该可以解决此问题。设置为0似乎表示无穷大。
    补充阅读:

  • https://github.com/docker/for-mac/issues/2197#issuecomment-359866362
  • https://github.com/docker/for-mac/issues/2406
  • https://github.com/docker/for-win/issues/2639(对于Windows)

  • P.S. 原始解决方案来自this PhpStorm Forums thread

    关于docker - Xdebug:在将IDE最小化几分钟后,脚本恢复在后台自动运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63077622/

    相关文章:

    angular - 在Docker中部署Spring Boot和Angular应用时出现CORS错误

    google-app-engine - 配置(PhpStorm 2017.2.3 + Google App Engine SDK PHP 1.9.57)目录有效..?

    php - 使用Docker通过终端运行PHPUnit

    php - phpunit 有默认位置吗?或者当我想使用它时,我是否必须继续在命令行中导出路径?

    postgresql - 在 centos docker 图像上初始化 postgres 失败,无法获得 D-Bus 连接 : Operation not permitted

    docker - 是否可以使用Http通过Http连接Docker容器

    php - JetBrains WebIDE : PHP variable type hinting?

    symfony - PhpStorm 7.1.3、XDebug 2.2.3、Symfony 2.4 - 未找到 WebTestCase

    angularjs - 如何向每个 Angular.js $http 请求添加添加请求参数(例如启动 xdebug session )

    docker - 通过docker-compose down持久化卷的问题