laravel - 如何使用 Laradock 和 PhpStorm 配置 Xdebug

标签 laravel phpstorm xdebug laradock

我正在尝试使用 PhpStorm 和 Laradock 配置 Xdebug。

我是这样开始的: https://laradock.io/documentation/#install-xdebug

我可以看到 Xdebug 正在运行:

php-fpm/xdebug status
 with Xdebug v2.9.6, Copyright (c) 2002-2020, by Derick Rethans

这是我的 PhpStorm 配置: enter image description here enter image description here enter image description here enter image description here enter image description here enter image description here

我添加了一个断点,但调试器没有停止。

有人能看出我做错了什么吗?

我的项目位于服务器上的 /code/test 中,即 /var/www 。 Laradock 位于 /code/laradock

更新: Xdebug 日志显示:

[6] Log opened at 2020-07-10 10:44:55
[6] I: Connecting to configured address/port: host.docker.internal:9000.
[6] E: Time-out connecting to client (Waited: 200 ms). :-(
[6] Log closed at 2020-07-10 10:44:55

更新:

将 ini 更改为此(以及 IDE 中的端口):

xdebug.remote_host=192.168.68.101
xdebug.remote_connect_back=0
xdebug.remote_port=9001
[6] Log opened at 2020-07-10 12:11:03
[6] I: Connecting to configured address/port: 192.168.68.101:9001.
[6] E: Time-out connecting to client (Waited: 200 ms). :-(
[6] Log closed at 2020-07-10 12:11:04

最佳答案

我让这个工作正常了,我必须做几件事:

  1. 关闭了我的防火墙。
  2. 更改了我的配置:
xdebug.remote_host="172.17.0.1" # this is listed under docker0 using ifconfig
xdebug.remote_connect_back=0
xdebug.remote_port=9000
xdebug.idekey=PHPSTORM

关于laravel - 如何使用 Laradock 和 PhpStorm 配置 Xdebug,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62831412/

相关文章:

php - 如何使用 Eclipse PDT(xdebug 和 zend 调试器)调试 PHP 应用程序

php - 删除数组中的重复项以及按相反顺序 PHP Laravel

Laravel 和 phpStorm 集成 - "cannot resolve directory"

PHP 检查报告未使用的 CSS 选择器。它由 PHP 回显标签使用

node.js - YUI 压缩机在 PhpStorm 中给出未处理的 'error' 事件

php - mysqli_affected_rows() 返回 -1 但查询有效

mysql - 我如何对连续范围进行分组(mysql 5.7)

php - Laravel 迁移,hasColumn 方法失败

php - 即使在 XDebug/PHPStorm 中没有设置断点,浏览器也会挂起

PHPStorm Xdebug 总是在第一行中断