运行 Laravel 8 上的 Xdebug 和 Ubuntu 上的 Sail & PhpStorm

Run Xdebug on Laravel 8 with Sail & PhpStorm on Ubuntu

我有 Ubuntu 18.04 和全新安装的 Laravel 8。我想将 Xdebug 与 Sail 一起使用。我遵循了 instructions 如下:

  1. 已将 SAIL_XDEBUG_MODE=develop,debug 添加到 env
  2. 运行 sail build --no-cachesail up -d
  3. 运行 docker inspect -f {{range.NetworkSettings.Networks}}{{.Gateway}}{{end}} <container-name> 获取我的 docker 容器的 IP
  4. 已将 SAIL_XDEBUG_CONFIG="client_host=172.19.2.1" 添加到 env(第 3 步中的 IP)

接下来我继续 instruction from PhpStorm for debugging:

  1. 已通过 sail php -v 验证 Xdebug 处于活动状态。
  2. 在 PhpStorm 中启用侦听调试连接
  3. 设置断点并启用Break at first line in PHP scripts
  4. 已为 Chrome
  5. 安装 Xdebug Helper 浏览器扩展
  6. 单击扩展中的调试(错误现在是绿色的)
  7. 刷新页面,页面构建很慢,但加载完全(应该不是这样,应该挂在断点上)

如果我切换到 PhpStorm,则不会弹出任何对话框。不过按照说明,应该是有些说明的。

Reload the page in the browser and return to PhpStorm. In the Incoming Connection From dialog, select the path mappings so that PhpStorm can map the remote files on the web server to the local files in your project.

Hera 是我的调试设置:

我错过了什么?

感谢@LazyOne 的帮助,我让它工作了。我只需要跳过说明中的第 3 步和第 4 步。

或者换句话说,我必须遵循 https://laravel.com/docs/8.x/sail#debugging-with-xdebug 的说明,但忽略了 Linux Host IP Configuration 部分,尽管我在 Linux 上。看起来这个部分不适合 Ubuntu?