0

I configured Xdebug according to this guide

It`s resulting xdebug_config:

zend_extension=xdebug
xdebug.remote_port=9004
xdebug.remote_host=172.24.240.47
xdebug.remote_enable=1
xdebug.remote_connect_back=0
xdebug.remote_log=/var/www/html/xdebug.log

In PhpStorm, I registered port 9004 in the Xdebug menu

It`s xdebug log:

[20] Log opened at 2022-03-23 10:29:32
[20] I: Connecting to configured address/port: 172.24.240.47:9004.
[20] I: Connected to client. :-)
[20] -> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" fileuri="file:///var/www/html/index.php" language="PHP" xdebug:language_version="7.2.34" protocol_version="1.0" appid="20" idekey="16813"><engine version="2.7.2"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[https://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2019 by Derick Rethans]]></copyright></init>
[20]
[20] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" status="stopping" reason="ok"></response>
[20]
[20] Log closed at 2022-03-23 10:29:32

But breakpoint does not work :(

if I use xdebug3, i catch next error:

[17] Log opened at 2022-03-23 12:36:17.689724
[17] [Step Debug] INFO: Checking remote connect back address.
[17] [Step Debug] INFO: Checking header 'HTTP_X_FORWARDED_FOR'.
[17] [Step Debug] INFO: Checking header 'REMOTE_ADDR'.
[17] [Step Debug] INFO: Client host discovered through HTTP header, connecting to 172.25.0.1:9003.
[17] [Step Debug] WARN: Creating socket for '172.25.0.1:9003', poll success, but error: Operation now in progress (29).
[17] [Step Debug] WARN: Could not connect to client host discovered through HTTP headers, connecting to configured address/port: 172.24.240.47:9003. :-|
[17] [Step Debug] WARN: Creating socket for '172.24.240.47:9003', poll success, but error: Operation now in progress (29).
[17] [Step Debug] ERR: Could not connect to debugging client. Tried: 172.25.0.1:9003 (from REMOTE_ADDR HTTP header), 172.24.240.47:9003 (fallback through xdebug.client_host/xdebug.client_port) :-(
[17] Log closed at 2022-03-23 12:36:17.691381

I tried to share port in docker-compose file

ports:
  - 80:80
  - 9009:9009

And log now

[19] Log opened at 2022-03-23 15:52:45.549575
[19] [Step Debug] INFO: Checking remote connect back address.
[19] [Step Debug] INFO: Checking header 'HTTP_X_FORWARDED_FOR'.
[19] [Step Debug] INFO: Checking header 'REMOTE_ADDR'.
[19] [Step Debug] INFO: Client host discovered through HTTP header, connecting to 172.26.0.1:9009.
[19] [Step Debug] INFO: Connected to debugging client: 172.26.0.1:9009 (from REMOTE_ADDR HTTP header). :-)
[19] [Step Debug] -> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" fileuri="file:///var/www/html/index.php" language="PHP" xdebug:language_version="7.2.34" protocol_version="1.0" appid="19"><engine version="3.1.3"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[https://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2022 by Derick Rethans]]></copyright></init>

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

[19] [Step Debug] WARN: 2022-03-23 15:52:45.554242: There was a problem sending 179 bytes on socket 11: Broken pipe.
[19] Log closed at 2022-03-23 15:52:45.554442
sveta600
  • 439
  • 4
  • 8
  • This one worked for me: https://stackoverflow.com/a/65553231/16173622 – Pedro Rodrigues Mar 23 '22 at 11:07
  • @PedroRodrigues, are you use docker desktop? – sveta600 Mar 23 '22 at 11:28
  • @LazyOne, i changed port to 9008, and now: Creating socket for '172.24.240.47:9008', poll success, but error: Operation now in progress (29). – sveta600 Mar 23 '22 at 11:33
  • Yes, I am @sveta600 – Pedro Rodrigues Mar 23 '22 at 11:57
  • I installed docker on wsl2 without docker desktop – sveta600 Mar 23 '22 at 12:04
  • 1
    *"I tried to share port in docker-compose file `- 9009:9009`"* is this 9009 is for Xdebug? If yes then it's NOT needed because it's Xdebug that connects to the IDE (outgoing connection from container point of view) and NOT other way around. Such port mapping is for incoming (into container) connections... P.S. Docker inside WSL -- cannot help you here, never used this set up myself. – LazyOne Mar 23 '22 at 18:25
  • `host.docker.internal` works for Docker for Linux for a while now. Remove all Xdebug-related mappings in `docker-compose.yml`, make PhpStorm listen to the port you have specified as `xdebug.remote_port` and use `host.docker.internal` as `xdebug.remote_host`. – Eugene Morozov Mar 23 '22 at 20:45
  • Creating socket for 'host.docker.internal:9003', poll success, but error: Operation now in progress (29). – sveta600 Mar 24 '22 at 21:04

0 Answers0