Dar*_*s.V 5 xdebug phpstorm docker
当连接来自 docker 容器时,PhpStorm xdebug 找不到文件
以此一试。当将 PHP_IDE_CONFIG 添加到我的 docker 时,xdebug 甚至没有停止。在添加该 env 变量之前,xdebug 至少会停止,但我无法单步执行,它只是显示一个错误:
本地找不到文件
'/var/www/pmp-api/bin/console'
。要修复它,请通过环境变量设置服务器名称PHP_IDE_CONFIG
并重新启动调试会话。
#- PHP_IDE_CONFIG="serverName=pmpapi.local"
- XDEBUG_CONFIG=idekey=PHPSTORM
Run Code Online (Sandbox Code Playgroud)
后来我评论PHP_IDE_CONFIG
补充了XDEBUG_CONFIG
。PHPSTORM 在 PhpStorm 中设置为 idekey。
也在 Nginx config 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["
检查日志。检查 xdebug 是否连接,是否尝试连接到正确的 ip。就我而言,它试图连接到错误的 IP。因此需要将此配置更改为此值:
xdebug.remote_host=192.168.31.26
接下来的事情 - PhpStorm 开始写作
无法解析外部 Xdebug 连接的服务器名称。要修复它,请在远程服务器上创建环境变量 PHP_IDE_CONFIG。Windows:设置 PHP_IDE_CONFIG="serverName=SomeName" Linux / Mac OS X:导出 PHP_IDE_CONFIG="serverName=SomeName"。
所以进入 docker 容器并运行导出。ServerName 必须与 PhpStorm 配置中的 Name 字段相同
归档时间: |
|
查看次数: |
9269 次 |
最近记录: |