How to fix the "Incoming connection from Xdebug" in PhpStorm

Viewed 282

I have Xdebug 2.9.8 installed in a Docker container and the xdebug.ini settings are:

xdebug.default_enable=1
xdebug.remote_enable=on
xdebug.profiler_enable = off
xdebug.profiler_enable_trigger = off
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir = "/tmp/php7-xdebug.log"
xdebug.remote_log="/tmp/xdebug.log"
xdebug.remote_autostart=1
xdebug.remote_connect_back=1
xdebug.max_nesting_level = 1000
xdebug.remote_port=9000
xdebug.remote_handler = dbgp
xdebug.remote_mode = req
xdebug.remote_host=host.docker.internal
xdebug.idekey=PHPSTORM
xdebug.remote_handler=dbgp
xdebug.max_nesting_level=1500T
xdebug.var_display_max_children = 512
xdebug.var_display_max_data = 512
xdebug.var_display_max_depth = 12

But I keep getting the pop-up from PhpStorm:

enter image description here

I don't know if it has any relations with this post:

PhpStorm keeps asking for configuring "Incoming Connection From Xdebug" while I already have a server config

I also have the logs from /tmp/xdebug.log:

[23] Log opened at 2021-10-21 12:01:06
[23] I: Checking remote connect back address.
[23] I: Checking header 'HTTP_X_FORWARDED_FOR'.
[23] I: Checking header 'REMOTE_ADDR'.
[23] I: Remote address found, connecting to 172.24.0.1:9000.
[23] I: Connected to client. :-)
[23] -> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" fileuri="file:///var/www/html/domestico2.local/pub/index.php" language="PHP" xdebug:language_version="7.4.24" protocol_version="1.0" appid="23" idekey="PHPSTORM"><engine version="2.9.8"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[https://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2020 by Derick Rethans]]></copyright></init>

[23] <- feature_set -i 1 -n show_hidden -v 1
[23] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="1" feature="show_hidden" success="1"></response>

[23] <- feature_set -i 2 -n max_depth -v 1
[23] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="2" feature="max_depth" success="1"></response>

[23] <- feature_set -i 3 -n max_children -v 100
[23] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="3" feature="max_children" success="1"></response>

[23] <- feature_set -i 4 -n extended_properties -v 1
[23] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="4" feature="extended_properties" success="1"></response>

[23] <- feature_set -i 5 -n notify_ok -v 1
[23] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="5" feature="notify_ok" success="1"></response>

[23] <- feature_set -i 6 -n resolved_breakpoints -v 1
[23] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="6" feature="resolved_breakpoints" success="1"></response>

[23] <- stdout -i 7 -c 1
[23] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="stdout" transaction_id="7" success="1"></response>

[23] <- status -i 8
[23] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="status" transaction_id="8" status="starting" reason="ok"></response>

[23] <- step_into -i 9
[23] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="step_into" transaction_id="9" status="break" reason="ok"><xdebug:message filename="file:///var/www/html/project.local/pub/index.php" lineno="12"></xdebug:message></response>

[23] <- eval -i 10 -- aXNzZXQoJF9TRVJWRVJbJ1BIUF9JREVfQ09ORklHJ10p
[23] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="eval" transaction_id="10"><property type="bool"><![CDATA[0]]></property></response>

[23] <- eval -i 11 -- aXNzZXQoJF9TRVJWRVJbJ1NFUlZFUl9OQU1FJ10p
[23] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="eval" transaction_id="11"><property type="bool"><![CDATA[1]]></property></response>

[23] <- eval -i 12 -- KHN0cmluZykoJF9TRVJWRVJbJ1NFUlZFUl9OQU1FJ10p
[23] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="eval" transaction_id="12"><property type="string" size="16" encoding="base64"><![CDATA[ZG9tZXN0aWNvMi5sb2NhbA==]]></property></response>

[23] <- eval -i 13 -- KHN0cmluZykoJF9TRVJWRVJbJ1NFUlZFUl9QT1JUJ10p
[23] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="eval" transaction_id="13"><property type="string" size="2" encoding="base64"><![CDATA[ODA=]]></property></response>

[23] <- eval -i 14 -- KHN0cmluZykoJF9TRVJWRVJbJ1JFUVVFU1RfVVJJJ10p
[23] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="eval" transaction_id="14"><property type="string" size="12" encoding="base64"><![CDATA[L2Zhdmljb24uaWNv]]></property></response>

Help me StackOverflow, you're my only hope!

P.S. The path mapping config:

enter image description here

1 Answers

According to your info (screenshots of popup + PHP | Servers settings as well as Xdebug log file) you need to edit your Server entry a bit:

Change the Host from localhost to be the actual domain name: domestico2.local. It should work now.


Local test that I did:

URL: http://idetest.local.test/test.php
Server entry (it's all local, no path mappings needed in my case):
enter image description here

The debug works just fine.

If I now change the Host to some different name (e.g. idetest22.local.test) and try to debug the same URL I will see the similar popup:

enter image description here

If I click on "Accept" button PhpStorm will make a new Server entry for that domain for me:

enter image description here

Related