Xdebug PHP 7.1 PhpStorm remote server with Docker. How?

陌路散爱 提交于 2020-06-29 03:34:36

问题


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. 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 not working:(

Xdebug log:

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 want connect to remote server for debbuging. I am not interested create port forwarding into docker container.

What am I doing wrong?

Screenshots:


回答1:


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

But it works using ngrok. You should:

  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.

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

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



来源:https://stackoverflow.com/questions/53496300/xdebug-php-7-1-phpstorm-remote-server-with-docker-how

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!