如何修复 "To fix it set server name by environment variable PHP_IDE_CONFIG and restart debug session."?
How to fix "To fix it set server name by environment variable PHP_IDE_CONFIG and restart debug session."?
PhpStorm xdebug can't find file when connection comes from docker container
试过这个。当添加 PHP_IDE_CONFIG 到我的 docker 时,xdebug 甚至没有停止。在添加该 env 变量之前,xdebug 至少停止了,但我无法单步执行,它只是显示一个错误:
Cannot find file '/var/www/pmp-api/bin/console'
locally. To fix it set
server name by environment variable PHP_IDE_CONFIG
and restart debug
session.
我有
#- PHP_IDE_CONFIG="serverName=pmpapi.local"
- XDEBUG_CONFIG=idekey=PHPSTORM
后来我评论了 PHP_IDE_CONFIG
并添加了 XDEBUG_CONFIG
。 PHPSTORM 在 PhpStorm 中设置为 idekey。
也在 Nginx 配置中尝试过
server_name_;
还有:
xdebug.extended_info = 1
为什么这还不行?
更新
没有PHP_IDE_CONFIG变量时:
[17] Log opened at 2021-11-16 18:51:45
[17] I: Checking remote connect back address.
[17] I: Checking header 'HTTP_X_FORWARDED_FOR'.
[17] I: Checking header 'REMOTE_ADDR'.
[17] W: Remote address not found, connecting to configured address/port: 192.168.31.26:9001. :-|
[17] I: Connected to client. :-)
[17] -> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" fileuri="file:///var/www/pmp-api/bin/console" language="PHP" xdebug:language_version="7.2.31" protocol_version="1.0" appid="17"><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>
[17] <- eval -i 1 -- KHN0cmluZykoaW5pX2dldCgneGRlYnVnLmNvdmVyYWdlX2VuYWJsZScpLic7Jy5pbmlfZ2V0KCd4ZGVidWcucHJvZmlsZXJfZW5hYmxlJykuJzsnLmluaV9nZXQoJ3hkZWJ1Zy5yZW1vdGVfYXV0b3N0YXJ0JykuJzsnLmluaV9nZXQoJ3hkZWJ1Zy5yZW1vdGVfY29ubmVjdF9iYWNrJykuJzsnLmluaV9nZXQoJ3hkZWJ1Zy5yZW1vdGVfbW9kZScpKQ==
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="eval" transaction_id="1"><property type="string" size="11" encoding="base64"><![CDATA[MTswOzE7MTtyZXE=]]></property></response>
[17] <- feature_set -i 2 -n show_hidden -v 1
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="2" feature="show_hidden" success="1"></response>
[17] <- feature_set -i 3 -n max_depth -v 1
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="3" feature="max_depth" success="1"></response>
[17] <- feature_set -i 4 -n max_children -v 100
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="4" feature="max_children" success="1"></response>
[17] <- feature_set -i 5 -n extended_properties -v 1
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="5" feature="extended_properties" success="1"></response>
[17] <- feature_set -i 6 -n notify_ok -v 1
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="6" feature="notify_ok" success="1"></response>
[17] <- feature_set -i 7 -n resolved_breakpoints -v 1
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="7" feature="resolved_breakpoints" success="1"></response>
[17] <- stdout -i 8 -c 1
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="stdout" transaction_id="8" success="1"></response>
[17] <- status -i 9
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="status" transaction_id="9" status="starting" reason="ok"></response>
[17] <- step_into -i 10
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="step_into" transaction_id="10" status="break" reason="ok"><xdebug:message filename="file:///var/www/pmp-api/bin/console" lineno="9"></xdebug:message></response>
[17] <- eval -i 11 -- aXNzZXQoJF9TRVJWRVJbJ1BIUF9JREVfQ09ORklHJ10p
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="eval" transaction_id="11"><property type="bool"><![CDATA[0]]></property></response>
[17] <- eval -i 12 -- aXNzZXQoJF9TRVJWRVJbJ1NFUlZFUl9OQU1FJ10p
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="eval" transaction_id="12"><property type="bool"><![CDATA[0]]></property></response>
[17] <- eval -i 13 -- aXNzZXQoJF9TRVJWRVJbJ1NTSF9DT05ORUNUSU9OJ10p
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="eval" transaction_id="13"><property type="bool"><![CDATA[0]]></property></response>
[17] <- eval -i 14 -- aXNzZXQoJF9TRVJWRVJbJ1NFUlZFUl9BRERSJ10p
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="eval" transaction_id="14"><property type="bool"><![CDATA[0]]></property></response>
[17] <- breakpoint_set -i 15 -t line -f file:///home/agmis/projects/pmp-api/src/Service/Invoice/InvoiceService.php -n 70
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="15" id="170001" resolved="unresolved"></response>
[17] <- breakpoint_set -i 16 -t line -f file:///home/agmis/projects/pmp-api/src/Service/Order/OrderService.php -n 78
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="16" id="170002" resolved="unresolved"></response>
[17] <- breakpoint_set -i 17 -t line -f file:///home/agmis/projects/pmp-api/src/Repository/OrderRepository.php -n 360
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="17" id="170003" resolved="unresolved"></response>
[17] <- breakpoint_set -i 18 -t line -f file:///home/agmis/projects/pmp-api/src/Service/Order/OrderService.php -n 79
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="18" id="170004" resolved="unresolved"></response>
[17] <- breakpoint_set -i 19 -t line -f file:///home/agmis/projects/pmp-api/src/Controller/v1/Orders/OrderController.php -n 322
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="19" id="170005" resolved="unresolved"></response>
[17] <- breakpoint_set -i 20 -t line -f file:///home/agmis/projects/pmp-api/src/Repository/OrderRepository.php -n 625
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="20" id="170006" resolved="unresolved"></response>
[17] <- breakpoint_set -i 21 -t line -f file:///home/agmis/projects/pmp-api/src/Service/Order/OrderService.php -n 64
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="21" id="170007" resolved="unresolved"></response>
[17] <- breakpoint_set -i 22 -t line -f file:///home/agmis/projects/pmp-api/src/Controller/v2/Orders/OrderController.php -n 77
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="22" id="170008" resolved="unresolved"></response>
[17] <- breakpoint_set -i 23 -t line -f file:///home/agmis/projects/pmp-api/src/Service/Validator/CreateOrderValidator.php -n 139
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="23" id="170009" resolved="unresolved"></response>
[17] <- breakpoint_set -i 24 -t line -f file:///home/agmis/projects/pmp-api/src/Controller/v1/Orders/OrderController.php -n 207
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="24" id="170010" resolved="unresolved"></response>
[17] <- breakpoint_set -i 25 -t line -f file:///home/agmis/projects/pmp-api/bin/console -n 11
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="25" id="170011" resolved="unresolved"></response>
[17] <- breakpoint_set -i 26 -t line -f file:///home/agmis/projects/pmp-api/src/Service/Order/OrderService.php -n 74
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="26" id="170012" resolved="unresolved"></response>
[17] <- breakpoint_set -i 27 -t line -f file:///home/agmis/projects/pmp-api/src/Controller/v1/Orders/OrderController.php -n 451
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="27" id="170013" resolved="unresolved"></response>
[17] <- breakpoint_set -i 28 -t line -f file:///home/agmis/projects/pmp-api/src/Service/Order/OrderService.php -n 72
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="28" id="170014" resolved="unresolved"></response>
[17] <- breakpoint_set -i 29 -t line -f file:///home/agmis/projects/pmp-api/src/Controller/v2/Users/SellerController.php -n 380
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="29" id="170015" resolved="unresolved"></response>
[17] <- breakpoint_set -i 30 -t line -f file:///home/agmis/projects/pmp-api/src/Controller/v2/Users/SellerController.php -n 332
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="30" id="170016" resolved="unresolved"></response>
[17] <- breakpoint_set -i 31 -t line -f file:///home/agmis/projects/pmp-api/src/Repository/OrderRepository.php -n 359
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="31" id="170017" resolved="unresolved"></response>
[17] <- breakpoint_set -i 32 -t line -f file:///home/agmis/projects/pmp-api/src/Controller/v2/Users/SellerController.php -n 346
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="32" id="170018" resolved="unresolved"></response>
[17] <- stack_get -i 33
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="stack_get" transaction_id="33"><stack where="{main}" level="0" type="file" filename="file:///var/www/pmp-api/bin/console" lineno="9"></stack></response>
[17] <- stack_get -i 34
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="stack_get" transaction_id="34"><stack where="{main}" level="0" type="file" filename="file:///var/www/pmp-api/bin/console" lineno="9"></stack></response>
[17] <- context_names -i 35
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="context_names" transaction_id="35"><context name="Locals" id="0"></context><context name="Superglobals" id="1"></context><context name="User defined constants" id="2"></context></response>
[17] <- context_get -i 36 -d 0 -c 0
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="context_get" transaction_id="36" context="0"><property name="$application" fullname="$application" type="uninitialized"></property><property name="$env" fullname="$env" type="uninitialized"></property><property name="$input" fullname="$input" type="uninitialized"></property><property name="$kernel" fullname="$kernel" type="uninitialized"></property></response>
[17] <- context_get -i 37 -d 0 -c 1
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="context_get" transaction_id="37" context="1"><property name="$_COOKIE" fullname="$_COOKIE" type="array" children="0" numchildren="0" page="0" pagesize="100"></property><property name="$_ENV" fullname="$_ENV" type="array" children="1" numchildren="21" page="0" pagesize="100"><property name="PHP_EXTRA_CONFIGURE_ARGS" fullname="$_ENV["PHP_EXTRA_CONFIGURE_ARGS"]" type="string" size="77" encoding="base64"><![CDATA[LS1lbmFibGUtZnBtIC0td2l0aC1mcG0tdXNlcj13d3ctZGF0YSAtLXdpdGgtZnBtLWdyb3VwPXd3dy1kYXRhIC0tZGlzYWJsZS1jZ2k=]]></property><property name="HOSTNAME" fullname="$_ENV["HOSTNAME"]" type="string" size="12" encoding="base64"><![CDATA[Y2ExZmMwYzFjYjEz]]></property><property name="PHP_INI_DIR" fullname="$_ENV["PHP_INI_DIR"]" type="string" size="18" encoding="base64"><![CDATA[L3Vzci9sb2NhbC9ldGMvcGhw]]></property><property name="SHLVL" fullname="$_ENV["SHLVL"]" type="string" size="1" encoding="base64"><![CDATA[MQ==]]></property><property name="HOME" fullname="$_ENV["HOME"]" type="string" size="5" encoding="base64"><![CDATA[L3Jvb3Q=]]></property><property name="PHP_LDFLAGS" fullname="$_ENV["PHP_LDFLAGS"]" type="string" size="12" encoding="base64"><![CDATA[LVdsLC1PMSAtcGll]]></property><property name="PHP_CFLAGS" fullname="$_ENV["PHP_CFLAGS"]" type="string" size="83" encoding="base64"><![CDATA[LWZzdGFjay1wcm90ZWN0b3Itc3Ryb25nIC1mcGljIC1mcGllIC1PMiAtRF9MQVJHRUZJTEVfU09VUkNFIC1EX0ZJTEVfT0ZGU0VUX0JJVFM9NjQ=]]></property><property name="PHP_MD5" fullname="$_ENV["PHP_MD5"]" type="string" size="0" encoding="base64"><![CDATA[]]></property><property name="PHP_VERSION" fullname="$_ENV["PHP_VERSION"]" type="string" size="6" encoding="base64"><![CDATA[Ny4yLjMx]]></property><property name="GPG_KEYS" fullname="$_ENV["GPG_KEYS"]" type="string" size="81" encoding="base64"><![CDATA[MTcyOUY4MzkzOERBNDRFMjdCQTBGNEQzREJEQjM5NzQ3MEQxMjE3MiBCMUI0NEQ4RjAyMUU0RTJENjAyMUU5OTVEQzlGRjhEM0VFNUFGMjdG]]></property><property name="PHP_CPPFLAGS" fullname="$_ENV["PHP_CPPFLAGS"]" type="string" size="83" encoding="base64"><![CDATA[LWZzdGFjay1wcm90ZWN0b3Itc3Ryb25nIC1mcGljIC1mcGllIC1PMiAtRF9MQVJHRUZJTEVfU09VUkNFIC1EX0ZJTEVfT0ZGU0VUX0JJVFM9NjQ=]]></property><property name="PHP_ASC_URL" fullname="$_ENV["PHP_ASC_URL"]" type="string" size="55" encoding="base64"><![CDATA[aHR0cHM6Ly93d3cucGhwLm5ldC9kaXN0cmlidXRpb25zL3BocC03LjIuMzEudGFyLnh6LmFzYw==]]></property><property name="PHP_URL" fullname="$_ENV["PHP_URL"]" type="string" size="51" encoding="base64"><![CDATA[aHR0cHM6Ly93d3cucGhwLm5ldC9kaXN0cmlidXRpb25zL3BocC03LjIuMzEudGFyLnh6]]></property><property name="TERM" fullname="$_ENV["TERM"]" type="string" size="5" encoding="base64"><![CDATA[eHRlcm0=]]></property><property name="PATH" fullname="$_ENV["PATH"]" type="string" size="60" encoding="base64"><![CDATA[L3Vzci9sb2NhbC9zYmluOi91c3IvbG9jYWwvYmluOi91c3Ivc2JpbjovdXNyL2Jpbjovc2JpbjovYmlu]]></property><property name="SSH_AUTH_SOCK" fullname="$_ENV["SSH_AUTH_SOCK"]" type="string" size="10" encoding="base64"><![CDATA[L3NzaC1hZ2VudA==]]></property><property name="REDIS_HOST" fullname="$_ENV["REDIS_HOST"]" type="string" size="5" encoding="base64"><![CDATA[cmVkaXM=]]></property><property name="APP_ENV" fullname="$_ENV["APP_ENV"]" type="string" size="3" encoding="base64"><![CDATA[ZGV2]]></property><property type="string" size="78"><name encoding="base64"><![CDATA[UEhQSVpFX0RFUFM=]]></name><fullname encoding="base64"><![CDATA[JF9FTlZbIlBIUElaRV9ERVBTIl0=]]></fullname><value encoding="base64"><![CDATA[YXV0b2NvbmYgCQlkcGtnLWRldiBkcGtnIAkJZmlsZSAJCWcrKyAJCWdjYyAJCWxpYmMtZGV2IAkJbWFrZSAJCXBrZ2NvbmYgCQlyZTJj]]></value></property><property name="PWD" fullname="$_ENV["PWD"]" type="string" size="16" encoding="base64"><![CDATA[L3Zhci93d3cvcG1wLWFwaQ==]]></property><property name="PHP_SHA256" fullname="$_ENV["PHP_SHA256"]" type="string" size="64" encoding="base64"><![CDATA[OGJlYWE2MzRiYjg3OGE5NmFmOWJjODY0MzgxMWVhNDY5NzNmNWY0MWFkMmJmYjZhYjRjZmQyOTBlNWEzOTgwNg==]]></property></property><property name="$_FILES" fullname="$_FILES" type="array" children="0" numchildren="0" page="0" pagesize="100"></property><property name="$_GET" fullname="$_GET" type="array" children="0" numchildren="0" page="0" pagesize="100"></property><property name="$_POST" fullname="$_POST" type="array" children="0" numchildren="0" page="0" pagesize="100"></property><property name="$_REQUEST" fullname="$_REQUEST" type="array" children="0" numchildren="0" page="0" pagesize="100"></property><property name="$_SERVER" fullname="$_SERVER" type="array" children="1" numchildren="30" page="0" pagesize="100"><property name="PHP_EXTRA_CONFIGURE_ARGS" fullname="$_SERVER["PHP_EXTRA_CONFIGURE_ARGS"]" type="string" size="77" encoding="base64"><![CDATA[LS1lbmFibGUtZnBtIC0td2l0aC1mcG0tdXNlcj13d3ctZGF0YSAtLXdpdGgtZnBtLWdyb3VwPXd3dy1kYXRhIC0tZGlzYWJsZS1jZ2k=]]></property><property name="HOSTNAME" fullname="$_SERVER["HOSTNAME"]" type="string" size="12" encoding="base64"><![CDATA[Y2ExZmMwYzFjYjEz]]></property><property name="PHP_INI_DIR" fullname="$_SERVER["PHP_INI_DIR"]" type="string" size="18" encoding="base64"><![CDATA[L3Vzci9sb2NhbC9ldGMvcGhw]]></property><property name="SHLVL" fullname="$_SERVER["SHLVL"]" type="string" size="1" encoding="base64"><![CDATA[MQ==]]></property><property name="HOME" fullname="$_SERVER["HOME"]" type="string" size="5" encoding="base64"><![CDATA[L3Jvb3Q=]]></property><property name="PHP_LDFLAGS" fullname="$_SERVER["PHP_LDFLAGS"]" type="string" size="12" encoding="base64"><![CDATA[LVdsLC1PMSAtcGll]]></property><property name="PHP_CFLAGS" fullname="$_SERVER["PHP_CFLAGS"]" type="string" size="83" encoding="base64"><![CDATA[LWZzdGFjay1wcm90ZWN0b3Itc3Ryb25nIC1mcGljIC1mcGllIC1PMiAtRF9MQVJHRUZJTEVfU09VUkNFIC1EX0ZJTEVfT0ZGU0VUX0JJVFM9NjQ=]]></property><property name="PHP_MD5" fullname="$_SERVER["PHP_MD5"]" type="string" size="0" encoding="base64"><![CDATA[]]></property><property name="PHP_VERSION" fullname="$_SERVER["PHP_VERSION"]" type="string" size="6" encoding="base64"><![CDATA[Ny4yLjMx]]></property><property name="GPG_KEYS" fullname="$_SERVER["GPG_KEYS"]" type="string" size="81" encoding="base64"><![CDATA[MTcyOUY4MzkzOERBNDRFMjdCQTBGNEQzREJEQjM5NzQ3MEQxMjE3MiBCMUI0NEQ4RjAyMUU0RTJENjAyMUU5OTVEQzlGRjhEM0VFNUFGMjdG]]></property><property name="PHP_CPPFLAGS" fullname="$_SERVER["PHP_CPPFLAGS"]" type="string" size="83" encoding="base64"><![CDATA[LWZzdGFjay1wcm90ZWN0b3Itc3Ryb25nIC1mcGljIC1mcGllIC1PMiAtRF9MQVJHRUZJTEVfU09VUkNFIC1EX0ZJTEVfT0ZGU0VUX0JJVFM9NjQ=]]></property><property name="PHP_ASC_URL" fullname="$_SERVER["PHP_ASC_URL"]" type="string" size="55" encoding="base64"><![CDATA[aHR0cHM6Ly93d3cucGhwLm5ldC9kaXN0cmlidXRpb25zL3BocC03LjIuMzEudGFyLnh6LmFzYw==]]></property><property name="PHP_URL" fullname="$_SERVER["PHP_URL"]" type="string" size="51" encoding="base64"><![CDATA[aHR0cHM6Ly93d3cucGhwLm5ldC9kaXN0cmlidXRpb25zL3BocC03LjIuMzEudGFyLnh6]]></property><property name="TERM" fullname="$_SERVER["TERM"]" type="string" size="5" encoding="base64"><![CDATA[eHRlcm0=]]></property><property name="PATH" fullname="$_SERVER["PATH"]" type="string" size="60" encoding="base64"><![CDATA[L3Vzci9sb2NhbC9zYmluOi91c3IvbG9jYWwvYmluOi91c3Ivc2JpbjovdXNyL2Jpbjovc2JpbjovYmlu]]></property><property name="SSH_AUTH_SOCK" fullname="$_SERVER["SSH_AUTH_SOCK"]" type="string" size="10" encoding="base64"><![CDATA[L3NzaC1hZ2VudA==]]></property><property name="REDIS_HOST" fullname="$_SERVER["REDIS_HOST"]" type="string" size="5" encoding="base64"><![CDATA[cmVkaXM=]]></property><property name="APP_ENV" fullname="$_SERVER["APP_ENV"]" type="string" size="3" encoding="base64"><![CDATA[ZGV2]]></property><property type="string" size="78"><name encoding="base64"><![CDATA[UEhQSVpFX0RFUFM=]]></name><fullname encoding="base64"><![CDATA[JF9TRVJWRVJbIlBIUElaRV9ERVBTIl0=]]></fullname><value encoding="base64"><![CDATA[YXV0b2NvbmYgCQlkcGtnLWRldiBkcGtnIAkJZmlsZSAJCWcrKyAJCWdjYyAJCWxpYmMtZGV2IAkJbWFrZSAJCXBrZ2NvbmYgCQlyZTJj]]></value></property><property name="PWD" fullname="$_SERVER["PWD"]" type="string" size="16" encoding="base64"><![CDATA[L3Zhci93d3cvcG1wLWFwaQ==]]></property><property name="PHP_SHA256" fullname="$_SERVER["PHP_SHA256"]" type="string" size="64" encoding="base64"><![CDATA[OGJlYWE2MzRiYjg3OGE5NmFmOWJjODY0MzgxMWVhNDY5NzNmNWY0MWFkMmJmYjZhYjRjZmQyOTBlNWEzOTgwNg==]]></property><property name="PHP_SELF" fullname="$_SERVER["PHP_SELF"]" type="string" size="11" encoding="base64"><![CDATA[YmluL2NvbnNvbGU=]]></property><property name="SCRIPT_NAME" fullname="$_SERVER["SCRIPT_NAME"]" type="string" size="11" encoding="base64"><![CDATA[YmluL2NvbnNvbGU=]]></property><property name="SCRIPT_FILENAME" fullname="$_SERVER["SCRIPT_FILENAME"]" type="string" size="11" encoding="base64"><![CDATA[YmluL2NvbnNvbGU=]]></property><property name="PATH_TRANSLATED" fullname="$_SERVER["PATH_TRANSLATED"]" type="string" size="11" encoding="base64"><![CDATA[YmluL2NvbnNvbGU=]]></property><property name="DOCUMENT_ROOT" fullname="$_SERVER["DOCUMENT_ROOT"]" type="string" size="0" encoding="base64"><![CDATA[]]></property><property name="REQUEST_TIME_FLOAT" fullname="$_SERVER["REQUEST_TIME_FLOAT"]" type="float"><![CDATA[1637088705.79]]></property><property name="REQUEST_TIME" fullname="$_SERVER["REQUEST_TIME"]" type="int"><![CDATA[1637088705]]></property><property name="argv" fullname="$_SERVER["argv"]" type="array" children="1" numchildren="1"></property><property name="argc" fullname="$_SERVER["argc"]" type="int"><![CDATA[1]]></property></property></response>
[17] <- context_get -i 38 -d 0 -c 2
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="context_get" transaction_id="38" context="2"></response>
它停止但不在断点处。
当有
PHP_IDE_CONFIG="serverName=pmpapi.local"
[16] Log opened at 2021-11-16 18:41:18
[16] I: Checking remote connect back address.
[16] I: Checking header 'HTTP_X_FORWARDED_FOR'.
[16] I: Checking header 'REMOTE_ADDR'.
[16] W: Remote address not found, connecting to configured address/port: 192.168.128.11:9001. :-|
[16] W: Creating socket for '192.168.128.11:9001', poll success, but error: Operation in progress (29).
[16] E: Could not connect to client. :-(
[16] Log closed at 2021-11-16 18:41:18
所以它甚至没有停止。
更新:
今天尝试使用 PHP_IDE_CONFIG - 不会停止,但会连接。
但是脚本不会在断点处停止,只是执行。
为什么之前的 ip 可能不同 - 可能是我改变了 it.Sometimes 我的电脑 ip 改变了,所以我可能因此改变了,不记得了。不过现在看来是对的。
在 PhpStorm 甚至日志中我看到:
Cannot parse server name for external Xdebug connection.
To fix it create environment variable PHP_IDE_CONFIG on the remote server.
Windows: set PHP_IDE_CONFIG="serverName=SomeName"
Linux / Mac OS X: export PHP_IDE_CONFIG="serverName=SomeName".
感觉加了也没有这个变量。我不通过导出添加,而是添加 docker-compose.yml 并构建容器。我如何添加它的部分代码:
pmp-api-php:
environment:
- REDIS_HOST=redis
- APP_ENV=dev
- SSH_AUTH_SOCK=/ssh-agent
- PHP_IDE_CONFIG="serverName=pmpapi.local" # net nesustoja
有趣的是,当我按照 PhpStorm 的指示在 docker 容器终端中导出相同的变量时 - 它开始在断点处停止。
当我从 docker-compose.yml 中删除 PHP_IDE_CONFIG 行时,重新构建并再次导出,它仍然有效。好的。不完美,我希望我不需要每次配置都导出。但至少它有效。如果有办法设置成不用每次都导出,大概每次启动后就更好了。
谢谢。
查看日志。检查 xdebug 是否连接,如果它尝试连接到正确的 ip。
在我的例子中,它试图连接到错误的 ip。因此需要将此配置更改为此值:
xdebug.remote_host=192.168.31.26
下一步 - PhpStorm 开始编写
Cannot parse server name for external Xdebug connection. To fix it
create environment variable PHP_IDE_CONFIG on the remote server.
Windows: set PHP_IDE_CONFIG="serverName=SomeName" Linux / Mac OS X:
export PHP_IDE_CONFIG="serverName=SomeName".
因此进入 docker 容器并 运行 导出。 ServerName 必须与 PhpStorm 配置中的名称字段相同
PhpStorm xdebug can't find file when connection comes from docker container
试过这个。当添加 PHP_IDE_CONFIG 到我的 docker 时,xdebug 甚至没有停止。在添加该 env 变量之前,xdebug 至少停止了,但我无法单步执行,它只是显示一个错误:
Cannot find file
'/var/www/pmp-api/bin/console'
locally. To fix it set server name by environment variablePHP_IDE_CONFIG
and restart debug session.
我有
#- PHP_IDE_CONFIG="serverName=pmpapi.local"
- XDEBUG_CONFIG=idekey=PHPSTORM
后来我评论了 PHP_IDE_CONFIG
并添加了 XDEBUG_CONFIG
。 PHPSTORM 在 PhpStorm 中设置为 idekey。
也在 Nginx 配置中尝试过 server_name_;
还有: xdebug.extended_info = 1
为什么这还不行?
更新
没有PHP_IDE_CONFIG变量时:
[17] Log opened at 2021-11-16 18:51:45
[17] I: Checking remote connect back address.
[17] I: Checking header 'HTTP_X_FORWARDED_FOR'.
[17] I: Checking header 'REMOTE_ADDR'.
[17] W: Remote address not found, connecting to configured address/port: 192.168.31.26:9001. :-|
[17] I: Connected to client. :-)
[17] -> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" fileuri="file:///var/www/pmp-api/bin/console" language="PHP" xdebug:language_version="7.2.31" protocol_version="1.0" appid="17"><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>
[17] <- eval -i 1 -- KHN0cmluZykoaW5pX2dldCgneGRlYnVnLmNvdmVyYWdlX2VuYWJsZScpLic7Jy5pbmlfZ2V0KCd4ZGVidWcucHJvZmlsZXJfZW5hYmxlJykuJzsnLmluaV9nZXQoJ3hkZWJ1Zy5yZW1vdGVfYXV0b3N0YXJ0JykuJzsnLmluaV9nZXQoJ3hkZWJ1Zy5yZW1vdGVfY29ubmVjdF9iYWNrJykuJzsnLmluaV9nZXQoJ3hkZWJ1Zy5yZW1vdGVfbW9kZScpKQ==
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="eval" transaction_id="1"><property type="string" size="11" encoding="base64"><![CDATA[MTswOzE7MTtyZXE=]]></property></response>
[17] <- feature_set -i 2 -n show_hidden -v 1
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="2" feature="show_hidden" success="1"></response>
[17] <- feature_set -i 3 -n max_depth -v 1
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="3" feature="max_depth" success="1"></response>
[17] <- feature_set -i 4 -n max_children -v 100
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="4" feature="max_children" success="1"></response>
[17] <- feature_set -i 5 -n extended_properties -v 1
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="5" feature="extended_properties" success="1"></response>
[17] <- feature_set -i 6 -n notify_ok -v 1
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="6" feature="notify_ok" success="1"></response>
[17] <- feature_set -i 7 -n resolved_breakpoints -v 1
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="7" feature="resolved_breakpoints" success="1"></response>
[17] <- stdout -i 8 -c 1
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="stdout" transaction_id="8" success="1"></response>
[17] <- status -i 9
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="status" transaction_id="9" status="starting" reason="ok"></response>
[17] <- step_into -i 10
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="step_into" transaction_id="10" status="break" reason="ok"><xdebug:message filename="file:///var/www/pmp-api/bin/console" lineno="9"></xdebug:message></response>
[17] <- eval -i 11 -- aXNzZXQoJF9TRVJWRVJbJ1BIUF9JREVfQ09ORklHJ10p
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="eval" transaction_id="11"><property type="bool"><![CDATA[0]]></property></response>
[17] <- eval -i 12 -- aXNzZXQoJF9TRVJWRVJbJ1NFUlZFUl9OQU1FJ10p
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="eval" transaction_id="12"><property type="bool"><![CDATA[0]]></property></response>
[17] <- eval -i 13 -- aXNzZXQoJF9TRVJWRVJbJ1NTSF9DT05ORUNUSU9OJ10p
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="eval" transaction_id="13"><property type="bool"><![CDATA[0]]></property></response>
[17] <- eval -i 14 -- aXNzZXQoJF9TRVJWRVJbJ1NFUlZFUl9BRERSJ10p
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="eval" transaction_id="14"><property type="bool"><![CDATA[0]]></property></response>
[17] <- breakpoint_set -i 15 -t line -f file:///home/agmis/projects/pmp-api/src/Service/Invoice/InvoiceService.php -n 70
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="15" id="170001" resolved="unresolved"></response>
[17] <- breakpoint_set -i 16 -t line -f file:///home/agmis/projects/pmp-api/src/Service/Order/OrderService.php -n 78
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="16" id="170002" resolved="unresolved"></response>
[17] <- breakpoint_set -i 17 -t line -f file:///home/agmis/projects/pmp-api/src/Repository/OrderRepository.php -n 360
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="17" id="170003" resolved="unresolved"></response>
[17] <- breakpoint_set -i 18 -t line -f file:///home/agmis/projects/pmp-api/src/Service/Order/OrderService.php -n 79
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="18" id="170004" resolved="unresolved"></response>
[17] <- breakpoint_set -i 19 -t line -f file:///home/agmis/projects/pmp-api/src/Controller/v1/Orders/OrderController.php -n 322
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="19" id="170005" resolved="unresolved"></response>
[17] <- breakpoint_set -i 20 -t line -f file:///home/agmis/projects/pmp-api/src/Repository/OrderRepository.php -n 625
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="20" id="170006" resolved="unresolved"></response>
[17] <- breakpoint_set -i 21 -t line -f file:///home/agmis/projects/pmp-api/src/Service/Order/OrderService.php -n 64
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="21" id="170007" resolved="unresolved"></response>
[17] <- breakpoint_set -i 22 -t line -f file:///home/agmis/projects/pmp-api/src/Controller/v2/Orders/OrderController.php -n 77
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="22" id="170008" resolved="unresolved"></response>
[17] <- breakpoint_set -i 23 -t line -f file:///home/agmis/projects/pmp-api/src/Service/Validator/CreateOrderValidator.php -n 139
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="23" id="170009" resolved="unresolved"></response>
[17] <- breakpoint_set -i 24 -t line -f file:///home/agmis/projects/pmp-api/src/Controller/v1/Orders/OrderController.php -n 207
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="24" id="170010" resolved="unresolved"></response>
[17] <- breakpoint_set -i 25 -t line -f file:///home/agmis/projects/pmp-api/bin/console -n 11
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="25" id="170011" resolved="unresolved"></response>
[17] <- breakpoint_set -i 26 -t line -f file:///home/agmis/projects/pmp-api/src/Service/Order/OrderService.php -n 74
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="26" id="170012" resolved="unresolved"></response>
[17] <- breakpoint_set -i 27 -t line -f file:///home/agmis/projects/pmp-api/src/Controller/v1/Orders/OrderController.php -n 451
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="27" id="170013" resolved="unresolved"></response>
[17] <- breakpoint_set -i 28 -t line -f file:///home/agmis/projects/pmp-api/src/Service/Order/OrderService.php -n 72
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="28" id="170014" resolved="unresolved"></response>
[17] <- breakpoint_set -i 29 -t line -f file:///home/agmis/projects/pmp-api/src/Controller/v2/Users/SellerController.php -n 380
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="29" id="170015" resolved="unresolved"></response>
[17] <- breakpoint_set -i 30 -t line -f file:///home/agmis/projects/pmp-api/src/Controller/v2/Users/SellerController.php -n 332
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="30" id="170016" resolved="unresolved"></response>
[17] <- breakpoint_set -i 31 -t line -f file:///home/agmis/projects/pmp-api/src/Repository/OrderRepository.php -n 359
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="31" id="170017" resolved="unresolved"></response>
[17] <- breakpoint_set -i 32 -t line -f file:///home/agmis/projects/pmp-api/src/Controller/v2/Users/SellerController.php -n 346
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="32" id="170018" resolved="unresolved"></response>
[17] <- stack_get -i 33
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="stack_get" transaction_id="33"><stack where="{main}" level="0" type="file" filename="file:///var/www/pmp-api/bin/console" lineno="9"></stack></response>
[17] <- stack_get -i 34
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="stack_get" transaction_id="34"><stack where="{main}" level="0" type="file" filename="file:///var/www/pmp-api/bin/console" lineno="9"></stack></response>
[17] <- context_names -i 35
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="context_names" transaction_id="35"><context name="Locals" id="0"></context><context name="Superglobals" id="1"></context><context name="User defined constants" id="2"></context></response>
[17] <- context_get -i 36 -d 0 -c 0
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="context_get" transaction_id="36" context="0"><property name="$application" fullname="$application" type="uninitialized"></property><property name="$env" fullname="$env" type="uninitialized"></property><property name="$input" fullname="$input" type="uninitialized"></property><property name="$kernel" fullname="$kernel" type="uninitialized"></property></response>
[17] <- context_get -i 37 -d 0 -c 1
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="context_get" transaction_id="37" context="1"><property name="$_COOKIE" fullname="$_COOKIE" type="array" children="0" numchildren="0" page="0" pagesize="100"></property><property name="$_ENV" fullname="$_ENV" type="array" children="1" numchildren="21" page="0" pagesize="100"><property name="PHP_EXTRA_CONFIGURE_ARGS" fullname="$_ENV["PHP_EXTRA_CONFIGURE_ARGS"]" type="string" size="77" encoding="base64"><![CDATA[LS1lbmFibGUtZnBtIC0td2l0aC1mcG0tdXNlcj13d3ctZGF0YSAtLXdpdGgtZnBtLWdyb3VwPXd3dy1kYXRhIC0tZGlzYWJsZS1jZ2k=]]></property><property name="HOSTNAME" fullname="$_ENV["HOSTNAME"]" type="string" size="12" encoding="base64"><![CDATA[Y2ExZmMwYzFjYjEz]]></property><property name="PHP_INI_DIR" fullname="$_ENV["PHP_INI_DIR"]" type="string" size="18" encoding="base64"><![CDATA[L3Vzci9sb2NhbC9ldGMvcGhw]]></property><property name="SHLVL" fullname="$_ENV["SHLVL"]" type="string" size="1" encoding="base64"><![CDATA[MQ==]]></property><property name="HOME" fullname="$_ENV["HOME"]" type="string" size="5" encoding="base64"><![CDATA[L3Jvb3Q=]]></property><property name="PHP_LDFLAGS" fullname="$_ENV["PHP_LDFLAGS"]" type="string" size="12" encoding="base64"><![CDATA[LVdsLC1PMSAtcGll]]></property><property name="PHP_CFLAGS" fullname="$_ENV["PHP_CFLAGS"]" type="string" size="83" encoding="base64"><![CDATA[LWZzdGFjay1wcm90ZWN0b3Itc3Ryb25nIC1mcGljIC1mcGllIC1PMiAtRF9MQVJHRUZJTEVfU09VUkNFIC1EX0ZJTEVfT0ZGU0VUX0JJVFM9NjQ=]]></property><property name="PHP_MD5" fullname="$_ENV["PHP_MD5"]" type="string" size="0" encoding="base64"><![CDATA[]]></property><property name="PHP_VERSION" fullname="$_ENV["PHP_VERSION"]" type="string" size="6" encoding="base64"><![CDATA[Ny4yLjMx]]></property><property name="GPG_KEYS" fullname="$_ENV["GPG_KEYS"]" type="string" size="81" encoding="base64"><![CDATA[MTcyOUY4MzkzOERBNDRFMjdCQTBGNEQzREJEQjM5NzQ3MEQxMjE3MiBCMUI0NEQ4RjAyMUU0RTJENjAyMUU5OTVEQzlGRjhEM0VFNUFGMjdG]]></property><property name="PHP_CPPFLAGS" fullname="$_ENV["PHP_CPPFLAGS"]" type="string" size="83" encoding="base64"><![CDATA[LWZzdGFjay1wcm90ZWN0b3Itc3Ryb25nIC1mcGljIC1mcGllIC1PMiAtRF9MQVJHRUZJTEVfU09VUkNFIC1EX0ZJTEVfT0ZGU0VUX0JJVFM9NjQ=]]></property><property name="PHP_ASC_URL" fullname="$_ENV["PHP_ASC_URL"]" type="string" size="55" encoding="base64"><![CDATA[aHR0cHM6Ly93d3cucGhwLm5ldC9kaXN0cmlidXRpb25zL3BocC03LjIuMzEudGFyLnh6LmFzYw==]]></property><property name="PHP_URL" fullname="$_ENV["PHP_URL"]" type="string" size="51" encoding="base64"><![CDATA[aHR0cHM6Ly93d3cucGhwLm5ldC9kaXN0cmlidXRpb25zL3BocC03LjIuMzEudGFyLnh6]]></property><property name="TERM" fullname="$_ENV["TERM"]" type="string" size="5" encoding="base64"><![CDATA[eHRlcm0=]]></property><property name="PATH" fullname="$_ENV["PATH"]" type="string" size="60" encoding="base64"><![CDATA[L3Vzci9sb2NhbC9zYmluOi91c3IvbG9jYWwvYmluOi91c3Ivc2JpbjovdXNyL2Jpbjovc2JpbjovYmlu]]></property><property name="SSH_AUTH_SOCK" fullname="$_ENV["SSH_AUTH_SOCK"]" type="string" size="10" encoding="base64"><![CDATA[L3NzaC1hZ2VudA==]]></property><property name="REDIS_HOST" fullname="$_ENV["REDIS_HOST"]" type="string" size="5" encoding="base64"><![CDATA[cmVkaXM=]]></property><property name="APP_ENV" fullname="$_ENV["APP_ENV"]" type="string" size="3" encoding="base64"><![CDATA[ZGV2]]></property><property type="string" size="78"><name encoding="base64"><![CDATA[UEhQSVpFX0RFUFM=]]></name><fullname encoding="base64"><![CDATA[JF9FTlZbIlBIUElaRV9ERVBTIl0=]]></fullname><value encoding="base64"><![CDATA[YXV0b2NvbmYgCQlkcGtnLWRldiBkcGtnIAkJZmlsZSAJCWcrKyAJCWdjYyAJCWxpYmMtZGV2IAkJbWFrZSAJCXBrZ2NvbmYgCQlyZTJj]]></value></property><property name="PWD" fullname="$_ENV["PWD"]" type="string" size="16" encoding="base64"><![CDATA[L3Zhci93d3cvcG1wLWFwaQ==]]></property><property name="PHP_SHA256" fullname="$_ENV["PHP_SHA256"]" type="string" size="64" encoding="base64"><![CDATA[OGJlYWE2MzRiYjg3OGE5NmFmOWJjODY0MzgxMWVhNDY5NzNmNWY0MWFkMmJmYjZhYjRjZmQyOTBlNWEzOTgwNg==]]></property></property><property name="$_FILES" fullname="$_FILES" type="array" children="0" numchildren="0" page="0" pagesize="100"></property><property name="$_GET" fullname="$_GET" type="array" children="0" numchildren="0" page="0" pagesize="100"></property><property name="$_POST" fullname="$_POST" type="array" children="0" numchildren="0" page="0" pagesize="100"></property><property name="$_REQUEST" fullname="$_REQUEST" type="array" children="0" numchildren="0" page="0" pagesize="100"></property><property name="$_SERVER" fullname="$_SERVER" type="array" children="1" numchildren="30" page="0" pagesize="100"><property name="PHP_EXTRA_CONFIGURE_ARGS" fullname="$_SERVER["PHP_EXTRA_CONFIGURE_ARGS"]" type="string" size="77" encoding="base64"><![CDATA[LS1lbmFibGUtZnBtIC0td2l0aC1mcG0tdXNlcj13d3ctZGF0YSAtLXdpdGgtZnBtLWdyb3VwPXd3dy1kYXRhIC0tZGlzYWJsZS1jZ2k=]]></property><property name="HOSTNAME" fullname="$_SERVER["HOSTNAME"]" type="string" size="12" encoding="base64"><![CDATA[Y2ExZmMwYzFjYjEz]]></property><property name="PHP_INI_DIR" fullname="$_SERVER["PHP_INI_DIR"]" type="string" size="18" encoding="base64"><![CDATA[L3Vzci9sb2NhbC9ldGMvcGhw]]></property><property name="SHLVL" fullname="$_SERVER["SHLVL"]" type="string" size="1" encoding="base64"><![CDATA[MQ==]]></property><property name="HOME" fullname="$_SERVER["HOME"]" type="string" size="5" encoding="base64"><![CDATA[L3Jvb3Q=]]></property><property name="PHP_LDFLAGS" fullname="$_SERVER["PHP_LDFLAGS"]" type="string" size="12" encoding="base64"><![CDATA[LVdsLC1PMSAtcGll]]></property><property name="PHP_CFLAGS" fullname="$_SERVER["PHP_CFLAGS"]" type="string" size="83" encoding="base64"><![CDATA[LWZzdGFjay1wcm90ZWN0b3Itc3Ryb25nIC1mcGljIC1mcGllIC1PMiAtRF9MQVJHRUZJTEVfU09VUkNFIC1EX0ZJTEVfT0ZGU0VUX0JJVFM9NjQ=]]></property><property name="PHP_MD5" fullname="$_SERVER["PHP_MD5"]" type="string" size="0" encoding="base64"><![CDATA[]]></property><property name="PHP_VERSION" fullname="$_SERVER["PHP_VERSION"]" type="string" size="6" encoding="base64"><![CDATA[Ny4yLjMx]]></property><property name="GPG_KEYS" fullname="$_SERVER["GPG_KEYS"]" type="string" size="81" encoding="base64"><![CDATA[MTcyOUY4MzkzOERBNDRFMjdCQTBGNEQzREJEQjM5NzQ3MEQxMjE3MiBCMUI0NEQ4RjAyMUU0RTJENjAyMUU5OTVEQzlGRjhEM0VFNUFGMjdG]]></property><property name="PHP_CPPFLAGS" fullname="$_SERVER["PHP_CPPFLAGS"]" type="string" size="83" encoding="base64"><![CDATA[LWZzdGFjay1wcm90ZWN0b3Itc3Ryb25nIC1mcGljIC1mcGllIC1PMiAtRF9MQVJHRUZJTEVfU09VUkNFIC1EX0ZJTEVfT0ZGU0VUX0JJVFM9NjQ=]]></property><property name="PHP_ASC_URL" fullname="$_SERVER["PHP_ASC_URL"]" type="string" size="55" encoding="base64"><![CDATA[aHR0cHM6Ly93d3cucGhwLm5ldC9kaXN0cmlidXRpb25zL3BocC03LjIuMzEudGFyLnh6LmFzYw==]]></property><property name="PHP_URL" fullname="$_SERVER["PHP_URL"]" type="string" size="51" encoding="base64"><![CDATA[aHR0cHM6Ly93d3cucGhwLm5ldC9kaXN0cmlidXRpb25zL3BocC03LjIuMzEudGFyLnh6]]></property><property name="TERM" fullname="$_SERVER["TERM"]" type="string" size="5" encoding="base64"><![CDATA[eHRlcm0=]]></property><property name="PATH" fullname="$_SERVER["PATH"]" type="string" size="60" encoding="base64"><![CDATA[L3Vzci9sb2NhbC9zYmluOi91c3IvbG9jYWwvYmluOi91c3Ivc2JpbjovdXNyL2Jpbjovc2JpbjovYmlu]]></property><property name="SSH_AUTH_SOCK" fullname="$_SERVER["SSH_AUTH_SOCK"]" type="string" size="10" encoding="base64"><![CDATA[L3NzaC1hZ2VudA==]]></property><property name="REDIS_HOST" fullname="$_SERVER["REDIS_HOST"]" type="string" size="5" encoding="base64"><![CDATA[cmVkaXM=]]></property><property name="APP_ENV" fullname="$_SERVER["APP_ENV"]" type="string" size="3" encoding="base64"><![CDATA[ZGV2]]></property><property type="string" size="78"><name encoding="base64"><![CDATA[UEhQSVpFX0RFUFM=]]></name><fullname encoding="base64"><![CDATA[JF9TRVJWRVJbIlBIUElaRV9ERVBTIl0=]]></fullname><value encoding="base64"><![CDATA[YXV0b2NvbmYgCQlkcGtnLWRldiBkcGtnIAkJZmlsZSAJCWcrKyAJCWdjYyAJCWxpYmMtZGV2IAkJbWFrZSAJCXBrZ2NvbmYgCQlyZTJj]]></value></property><property name="PWD" fullname="$_SERVER["PWD"]" type="string" size="16" encoding="base64"><![CDATA[L3Zhci93d3cvcG1wLWFwaQ==]]></property><property name="PHP_SHA256" fullname="$_SERVER["PHP_SHA256"]" type="string" size="64" encoding="base64"><![CDATA[OGJlYWE2MzRiYjg3OGE5NmFmOWJjODY0MzgxMWVhNDY5NzNmNWY0MWFkMmJmYjZhYjRjZmQyOTBlNWEzOTgwNg==]]></property><property name="PHP_SELF" fullname="$_SERVER["PHP_SELF"]" type="string" size="11" encoding="base64"><![CDATA[YmluL2NvbnNvbGU=]]></property><property name="SCRIPT_NAME" fullname="$_SERVER["SCRIPT_NAME"]" type="string" size="11" encoding="base64"><![CDATA[YmluL2NvbnNvbGU=]]></property><property name="SCRIPT_FILENAME" fullname="$_SERVER["SCRIPT_FILENAME"]" type="string" size="11" encoding="base64"><![CDATA[YmluL2NvbnNvbGU=]]></property><property name="PATH_TRANSLATED" fullname="$_SERVER["PATH_TRANSLATED"]" type="string" size="11" encoding="base64"><![CDATA[YmluL2NvbnNvbGU=]]></property><property name="DOCUMENT_ROOT" fullname="$_SERVER["DOCUMENT_ROOT"]" type="string" size="0" encoding="base64"><![CDATA[]]></property><property name="REQUEST_TIME_FLOAT" fullname="$_SERVER["REQUEST_TIME_FLOAT"]" type="float"><![CDATA[1637088705.79]]></property><property name="REQUEST_TIME" fullname="$_SERVER["REQUEST_TIME"]" type="int"><![CDATA[1637088705]]></property><property name="argv" fullname="$_SERVER["argv"]" type="array" children="1" numchildren="1"></property><property name="argc" fullname="$_SERVER["argc"]" type="int"><![CDATA[1]]></property></property></response>
[17] <- context_get -i 38 -d 0 -c 2
[17] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="context_get" transaction_id="38" context="2"></response>
它停止但不在断点处。
当有
PHP_IDE_CONFIG="serverName=pmpapi.local"
[16] Log opened at 2021-11-16 18:41:18
[16] I: Checking remote connect back address.
[16] I: Checking header 'HTTP_X_FORWARDED_FOR'.
[16] I: Checking header 'REMOTE_ADDR'.
[16] W: Remote address not found, connecting to configured address/port: 192.168.128.11:9001. :-|
[16] W: Creating socket for '192.168.128.11:9001', poll success, but error: Operation in progress (29).
[16] E: Could not connect to client. :-(
[16] Log closed at 2021-11-16 18:41:18
所以它甚至没有停止。
更新:
今天尝试使用 PHP_IDE_CONFIG - 不会停止,但会连接。 但是脚本不会在断点处停止,只是执行。
为什么之前的 ip 可能不同 - 可能是我改变了 it.Sometimes 我的电脑 ip 改变了,所以我可能因此改变了,不记得了。不过现在看来是对的。
在 PhpStorm 甚至日志中我看到:
Cannot parse server name for external Xdebug connection. To fix it create environment variable PHP_IDE_CONFIG on the remote server. Windows: set PHP_IDE_CONFIG="serverName=SomeName" Linux / Mac OS X: export PHP_IDE_CONFIG="serverName=SomeName".
感觉加了也没有这个变量。我不通过导出添加,而是添加 docker-compose.yml 并构建容器。我如何添加它的部分代码:
pmp-api-php:
environment:
- REDIS_HOST=redis
- APP_ENV=dev
- SSH_AUTH_SOCK=/ssh-agent
- PHP_IDE_CONFIG="serverName=pmpapi.local" # net nesustoja
有趣的是,当我按照 PhpStorm 的指示在 docker 容器终端中导出相同的变量时 - 它开始在断点处停止。
当我从 docker-compose.yml 中删除 PHP_IDE_CONFIG 行时,重新构建并再次导出,它仍然有效。好的。不完美,我希望我不需要每次配置都导出。但至少它有效。如果有办法设置成不用每次都导出,大概每次启动后就更好了。 谢谢。
查看日志。检查 xdebug 是否连接,如果它尝试连接到正确的 ip。 在我的例子中,它试图连接到错误的 ip。因此需要将此配置更改为此值:
xdebug.remote_host=192.168.31.26
下一步 - PhpStorm 开始编写
Cannot parse server name for external Xdebug connection. To fix it create environment variable PHP_IDE_CONFIG on the remote server. Windows: set PHP_IDE_CONFIG="serverName=SomeName" Linux / Mac OS X: export PHP_IDE_CONFIG="serverName=SomeName".
因此进入 docker 容器并 运行 导出。 ServerName 必须与 PhpStorm 配置中的名称字段相同