简体   繁体   中英

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"  
  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: phpstorm 设置 docker compose 文件(服务器部分)docker 检查服务器容器

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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