带有Docker的Xdebug PHP 7.1 PhpStorm远程服务器。怎么样? [英] Xdebug PHP 7.1 PhpStorm remote server with Docker. How?
问题描述
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"
- 我在PhpStorm中启用侦听调试连接
- 在终端中运行:ssh -R 10000:127.0.0.1:10000 root @ remote-server
- 添加断点
- 运行站点页面
- I enable "Listen debug connections" in PhpStorm
- Run in terminal: ssh -R 10000:127.0.0.1:10000 root@remote-server
- Add breakpoints
- 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:
- 在本地开发计算机上安装
ngrok
; - 运行
ngrok tcp 9000
; - 设置
xdebug.remote_port
和xdebug.remote_host
根据ngrok
的信息。
- install
ngrok
on your local development machine; - run
ngrok tcp 9000
; - set
xdebug.remote_port
andxdebug.remote_host
according tongrok
'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屋!