繁体   English   中英

Docker+php-fpm+Xdebug (Linux) + PhpStorm (Windows)

[英]Docker+php-fpm+Xdebug (on Linux) + PhpStorm (on Windows)

我在我的 Linux 主机上安装了 Docker 并使用 php-fpm 和 Xdebug 提出了一个容器。 PhpStorm 安装在 Windows 服务器上。 该项目通过gitlab吊装。 你能告诉我如何在这样的包中通过 Xdebug 设置调试吗?

Docker 版本。

Client: Docker Engine - Community
 Version:           19.03.13
 API version:       1.40
 Go version:        go1.13.15
 Git commit:        4484c46d9d
 Built:             Wed Sep 16 17:03:45 2020
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.13
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       4484c46d9d
  Built:            Wed Sep 16 17:02:21 2020
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.3.7
  GitCommit:        8fba4e9a7d01810a393d5d25a3621dc101981175
 runc:
  Version:          1.0.0-rc10
  GitCommit:        dc9208a3303feef5b3839f4323d9beb36df0a9dd
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

Xdebug 版本。 2.9.8

我需要在没有 DBGp 代理的情况下进行设置。 它需要使用路径映射进行配置。 这可能吗?

Linux 和 Windows 服务器在同一个子网上,但是当我打开页面时,Xdebug 日志中仍然出现超时。

UPD。 Xdebug 日志

[79] Log opened at 2021-04-08 06:51:34
[79] I: Checking remote connect back address.
[79] I: Checking header 'HTTP_X_FORWARDED_FOR'.
[79] I: Checking header 'REMOTE_ADDR'.
[79] I: Remote address found, connecting to xx.xx.xx.xx:9000.
[79] E: Time-out connecting to client (Waited: 200 ms). :-(
[79] Log closed at 2021-04-08 06:51:34

我也决定使用 DBGP Proxy,但它也存在一些问题。 尝试了 Windows 和 Linux 的代理。

[14688] Log opened at 2021-04-08 06:55:25
[14688] I: Checking remote connect back address.
[14688] I: Checking header 'HTTP_X_FORWARDED_FOR'.
[14688] I: Checking header 'REMOTE_ADDR'.
[14688] I: Remote address found, connecting to xx.xx.xx.xx:9000.
[14688] I: Connected to client. :-)
[14688] -> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" fileuri="file:///var/www/html/debug.php" language="PHP" xdebug:language_version="7.3.22" protocol_version="1.0" appid="14688" idekey="OR"><engine version="2.9.8"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[https://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2020 by Derick Rethans]]></copyright></init>

[78] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" status="stopping" reason="ok"></response>

[78] Log closed at 2021-04-08 06:56:11

但它不能通过浏览器和 Postman 工作。 并且只有通过 curl 的终端中的请求挂起,并且 Linux 上的代理发出以下

Xdebug Simple DBGp client (0.4.2)
Copyright 2019-2020 by Derick Rethans
In dumb client mode

Waiting for debug server to connect on port 9000.
Connect from 192.168.112.4:45638
DBGp/1.0: Xdebug 2.9.8 — For PHP 7.3.22
Debugging file:///var/www/html/debug.php (ID: 78/OR)

谢谢大家。 问题出在防火墙上。 我打开了 9000 端口,它工作了

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM