带有Docker的Xdebug PHP 7.1 PhpStorm远程服务器。怎么样? [英] Xdebug PHP 7.1 PhpStorm remote server with Docker. How?

查看:154
本文介绍了带有Docker的Xdebug PHP 7.1 PhpStorm远程服务器。怎么样?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Local:   
 - OS: MacOS  
 - IDE: PhpStorm   
 - Debug Port: 10000   
 - DBGp Proxy Host: 127.0.0.1   
 - DBGp Proxy Port: 10000    

Remote server:  
 - OS: Ubuntu  
 - Run project via docker and expose 10000 port    

Docker container:    
 - XDEBUG_CONFIG: "default_enable=1 remote_host=172.30.0.1 remote_enable=1 profiler_enable_trigger=0 remote_port=10000"  




  1. 我在PhpStorm中启用侦听调试连接

  2. 在终端中运行:ssh -R 10000:127.0.0.1:10000 root @ remote-server

  3. 添加断点

  4. 运行站点页面

  1. I enable "Listen debug connections" in PhpStorm
  2. Run in terminal: ssh -R 10000:127.0.0.1:10000 root@remote-server
  3. Add breakpoints
  4. Run site page




Xdebug不起作用:(

Xdebug not working:(

Xdebug日志:

Log opened at 2018-11-27 09:05:03
I: Connecting to configured address/port: 172.30.0.1:10000.
W: Creating socket for '172.30.0.1:10000', poll success, but error: Operation now in progress (29).
E: Could not connect to client. :-(
Log closed at 2018-11-27 09:05:03

I要连接到远程服务器进行调试。我对创建端口转发到Docker容器不感兴趣。

I want connect to remote server for debbuging. I am not interested create port forwarding into docker container.

我在做什么错了?

截屏:


Screenshots:

推荐答案

我尝试将xdebug与ssh隧道端口从远程docker托管的服务器转发到本地计算机一起使用,但没有成功。

I tried to use xdebug with ssh tunnel port forwarding from remote docker-hosted server to local machine, but have no success.

但是它可以使用 ngrok 。您应该:

But it works using ngrok. You should:


  1. 在本地开发计算机上安装 ngrok

  2. 运行 ngrok tcp 9000 ;

  3. 设置 xdebug.remote_port xdebug.remote_host 根据 ngrok 的信息。

  1. install ngrok on your local development machine;
  2. run ngrok tcp 9000;
  3. set xdebug.remote_port and xdebug.remote_host according to ngrok's info.

如果通过某种方式知道如何通过ssh隧道进行操作,请共享它。

If somehow known how to do the same by ssh tunneling, please share it.

9000-xdebug客户端的端口9000-PHP Storm的默认值,为此主题应为10000。

9000 - its xdebug client's port, 9000 - default value in PHP Storm, for this topic should be 10000.

这篇关于带有Docker的Xdebug PHP 7.1 PhpStorm远程服务器。怎么样?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆