PhpStorm Xdebug Symfony 配置

3

我正在困扰于主题配置问题。

按照这个指南:https://www.strangebuzz.com/en/blog/step-by-step-debugging-with-xdebug-symfony-and-phpstorm的步骤进行,我已经安装了XDEBUG。

PHP 7.4.13 (cli) (built: Nov 28 2020 06:24:59) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.13, Copyright (c), by Zend Technologies
    with Xdebug v3.0.1, Copyright (c) 2002-2020, by Derick Rethans

enter image description here

This is my xdebug config

zend_extension=xdebug.so
xdebub.remote_enable=1
xdebug.remote_mode = debug
xdebug.client_port = 9003

并安装了 Chrome 上的 xdebug 扩展程序

我在控制器中放置了一些断点以检查它是否起作用,但是没有任何反应。

如果尝试验证调试服务器配置,则会出现以下错误:

enter image description here

我认为这是 Symfony 中的安全配置问题,但我还尝试了“打开”子文件夹(public/test)的访问权限,但仍然没有成功。

有人可以帮我解决这个配置问题吗? 谢谢

[编辑]

如 @LazyOne 建议的那样,我删除了 xdebug 配置中的拼写错误行。

zend_extension=xdebug.so
xdebug.remote = debug
xdebug.client_port = 9003
xdebug.log=/media/leandro/Elements/Progetti/s4fgel/xdebug.log

我也尝试修改public文件夹中的index.php,添加了以下内容。
if (PHP_SAPI == 'cli-server') {
    // To help the built-in PHP dev server, check if the request was actually for
    // something which should probably be served as a static file
    $file = __DIR__ . $_SERVER['REQUEST_URI'];
    if (is_file($file)) {
        return false;
    }
}

根据phpstorm文档的建议,在验证调试器配置时,但结果是一个空白网页(public/test.php -> echo "test")。 [编辑2] 这是从phpinfo中打印的我的XDEBUG配置 ![enter image description here enter image description here enter image description here [编辑3] 我已将xdebug.idekey=*PHPSTORM*添加到xdebug配置中,但如果没有BP,则脚本会在每个请求上多次停止。 这是XDEBUG对所请求页面的完整日志,直到我达到第一个BP。
[38952] Log opened at 2020-12-17 13:46:02.963623
[38952] [Step Debug] INFO: Connecting to configured address/port: localhost:9003.
[38952] [Step Debug] INFO: Connected to debugging client: localhost:9003 (through xdebug.client_host/xdebug.client_port). :-)
[38952] [Step Debug] -> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" fileuri="file:///home/leandro/.symfony/php/7156db8ed3dfc7f503f23103615bf450f5f1947e-router.php" language="PHP" xdebug:language_version="7.4.13" protocol_version="1.0" appid="38952" idekey="PHPSTORM"><engine version="3.0.1"><![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>

[38952] [Step Debug] <- feature_set -i 1 -n show_hidden -v 1
[38952] [Step Debug] -> <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>

[38952] [Step Debug] <- feature_set -i 2 -n max_depth -v 1
[38952] [Step Debug] -> <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>

[38952] [Step Debug] <- feature_set -i 3 -n max_children -v 100
[38952] [Step Debug] -> <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>

[38952] [Step Debug] <- feature_set -i 4 -n extended_properties -v 1
[38952] [Step Debug] -> <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>

[38952] [Step Debug] <- feature_set -i 5 -n notify_ok -v 1
[38952] [Step Debug] -> <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>

[38952] [Step Debug] <- feature_set -i 6 -n resolved_breakpoints -v 1
[38952] [Step Debug] -> <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>

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

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

[38952] [Step Debug] <- step_into -i 9
[38952] [Step Debug] -> <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:///home/leandro/.symfony/php/7156db8ed3dfc7f503f23103615bf450f5f1947e-router.php" lineno="12"></xdebug:message></response>

[38952] [Step Debug] <- eval -i 10 -- aXNzZXQoJF9TRVJWRVJbJ1BIUF9JREVfQ09ORklHJ10p
[38952] [Step Debug] -> <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>

[38952] [Step Debug] <- eval -i 11 -- aXNzZXQoJF9TRVJWRVJbJ1NFUlZFUl9OQU1FJ10p
[38952] [Step Debug] -> <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>

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

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

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

[38952] [Step Debug] <- breakpoint_set -i 15 -t line -f file:///media/leandro/Elements/Progetti/s4fgel/src/Model/FintelUtility/Rateizzazione/Manager/RateizzazioneManager.php -n 445
[38952] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="15" id="389520386" resolved="unresolved"></response>

[38952] [Step Debug] <- breakpoint_set -i 16 -t line -f file:///media/leandro/Elements/Progetti/s4fgel/src/Model/FintelUtility/Rateizzazione/Manager/RateizzazioneManager.php -n 473
[38952] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="16" id="389520387" resolved="unresolved"></response>

[38952] [Step Debug] <- breakpoint_set -i 17 -t line -f file:///media/leandro/Elements/Progetti/s4fgel/src/Model/FintelUtility/Rateizzazione/Manager/RateizzazioneManager.php -n 409
[38952] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="17" id="389520388" resolved="unresolved"></response>

[38952] [Step Debug] <- breakpoint_set -i 18 -t line -f file:///media/leandro/Elements/Progetti/s4fgel/src/Model/FintelUtility/Rateizzazione/Manager/RateizzazioneManager.php -n 420
[38952] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="18" id="389520389" resolved="unresolved"></response>

[38952] [Step Debug] <- breakpoint_set -i 19 -t line -f file:///media/leandro/Elements/Progetti/s4fgel/src/Model/FintelUtility/Rateizzazione/Manager/RateizzazioneManager.php -n 430
[38952] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="19" id="389520390" resolved="unresolved"></response>

[38952] [Step Debug] <- breakpoint_set -i 20 -t line -f file:///media/leandro/Elements/Progetti/s4fgel/src/Model/FintelUtility/Rateizzazione/Manager/RateizzazioneManager.php -n 443
[38952] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="20" id="389520391" resolved="unresolved"></response>

[38952] [Step Debug] <- breakpoint_set -i 21 -t line -f file:///media/leandro/Elements/Progetti/s4fgel/src/Model/FintelUtility/Rateizzazione/Manager/RateizzazioneManager.php -n 483
[38952] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="21" id="389520392" resolved="unresolved"></response>

[38952] [Step Debug] <- breakpoint_set -i 22 -t line -f file:///media/leandro/Elements/Progetti/s4fgel/src/Model/FintelUtility/Rateizzazione/Manager/RateizzazioneManager.php -n 482
[38952] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="22" id="389520393" resolved="unresolved"></response>

[38952] [Step Debug] <- breakpoint_set -i 23 -t line -f file:///media/leandro/Elements/Progetti/s4fgel/src/Model/FintelUtility/Rateizzazione/Manager/RateizzazioneManager.php -n 411
[38952] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="23" id="389520394" resolved="unresolved"></response>

[38952] [Step Debug] <- breakpoint_set -i 24 -t line -f file:///media/leandro/Elements/Progetti/s4fgel/src/Model/FintelUtility/Rateizzazione/Manager/RateizzazioneManager.php -n 452
[38952] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="24" id="389520395" resolved="unresolved"></response>

[38952] [Step Debug] <- breakpoint_set -i 25 -t line -f file:///media/leandro/Elements/Progetti/s4fgel/src/Model/FintelUtility/Rateizzazione/Manager/RateizzazioneManager.php -n 459
[38952] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="25" id="389520396" resolved="unresolved"></response>

[38952] [Step Debug] <- breakpoint_set -i 26 -t line -f file:///media/leandro/Elements/Progetti/s4fgel/src/Model/FintelUtility/Rateizzazione/Manager/RateizzazioneManager.php -n 478
[38952] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="26" id="389520397" resolved="unresolved"></response>

[38952] [Step Debug] <- breakpoint_set -i 27 -t line -f file:///media/leandro/Elements/Progetti/s4fgel/src/Model/FintelUtility/Rateizzazione/Manager/RateizzazioneManager.php -n 426
[38952] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="27" id="389520398" resolved="unresolved"></response>

[38952] [Step Debug] <- breakpoint_set -i 28 -t line -f file:///media/leandro/Elements/Progetti/s4fgel/src/Model/FintelUtility/Rateizzazione/Manager/RateizzazioneManager.php -n 476
[38952] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="28" id="389520399" resolved="unresolved"></response>

[38952] [Step Debug] <- breakpoint_set -i 29 -t line -f file:///media/leandro/Elements/Progetti/s4fgel/src/Model/FintelUtility/Rateizzazione/Manager/RateizzazioneManager.php -n 416
[38952] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="29" id="389520400" resolved="unresolved"></response>

[38952] [Step Debug] <- breakpoint_set -i 30 -t line -f file:///media/leandro/Elements/Progetti/s4fgel/src/Model/FintelUtility/Rateizzazione/Manager/RateizzazioneManager.php -n 460
[38952] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="30" id="389520401" resolved="unresolved"></response>

[38952] [Step Debug] <- breakpoint_set -i 31 -t line -f file:///media/leandro/Elements/Progetti/s4fgel/src/Model/FintelUtility/Rateizzazione/Manager/RateizzazioneManager.php -n 418
[38952] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="31" id="389520402" resolved="unresolved"></response>

[38952] [Step Debug] <- breakpoint_set -i 32 -t line -f file:///media/leandro/Elements/Progetti/s4fgel/src/Model/FintelUtility/Rateizzazione/Manager/RateizzazioneManager.php -n 439
[38952] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="32" id="389520403" resolved="unresolved"></response>

[38952] [Step Debug] <- breakpoint_set -i 33 -t line -f file:///media/leandro/Elements/Progetti/s4fgel/src/Model/FintelUtility/Rateizzazione/Manager/RateizzazioneManager.php -n 484
[38952] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="33" id="389520404" resolved="unresolved"></response>

[38952] [Step Debug] <- breakpoint_set -i 34 -t line -f file:///media/leandro/Elements/Progetti/s4fgel/src/Model/FintelUtility/Rateizzazione/Manager/RateizzazioneManager.php -n 422
[38952] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="34" id="389520405" resolved="unresolved"></response>

[38952] [Step Debug] <- breakpoint_set -i 35 -t line -f file:///media/leandro/Elements/Progetti/s4fgel/src/Model/FintelUtility/Rateizzazione/Manager/RateizzazioneManager.php -n 475
[38952] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="35" id="389520406" resolved="unresolved"></response>

[38952] [Step Debug] <- breakpoint_set -i 36 -t line -f file:///media/leandro/Elements/Progetti/s4fgel/src/Model/FintelUtility/Rateizzazione/Manager/RateizzazioneManager.php -n 480
[38952] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="36" id="389520407" resolved="unresolved"></response>

[38952] [Step Debug] <- breakpoint_set -i 37 -t line -f file:///media/leandro/Elements/Progetti/s4fgel/src/Model/FintelUtility/Rateizzazione/Manager/RateizzazioneManager.php -n 406
[38952] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="37" id="389520408" resolved="unresolved"></response>

[38952] [Step Debug] <- breakpoint_set -i 38 -t line -f file:///media/leandro/Elements/Progetti/s4fgel/src/Model/FintelUtility/Rateizzazione/Manager/RateizzazioneManager.php -n 448
[38952] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="38" id="389520409" resolved="unresolved"></response>

[38952] [Step Debug] <- breakpoint_set -i 39 -t line -f file:///media/leandro/Elements/Progetti/s4fgel/src/Model/FintelUtility/Rateizzazione/Manager/RateizzazioneManager.php -n 454
[38952] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="39" id="389520410" resolved="unresolved"></response>

[38952] [Step Debug] <- breakpoint_set -i 40 -t line -f file:///media/leandro/Elements/Progetti/s4fgel/src/Model/FintelUtility/Rateizzazione/Manager/RateizzazioneManager.php -n 467
[38952] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="40" id="389520411" resolved="unresolved"></response>

[38952] [Step Debug] <- breakpoint_set -i 41 -t line -f file:///media/leandro/Elements/Progetti/s4fgel/src/Model/FintelUtility/Rateizzazione/Manager/RateizzazioneManager.php -n 438
[38952] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="41" id="389520412" resolved="unresolved"></response>

[38952] [Step Debug] <- breakpoint_set -i 42 -t line -f file:///media/leandro/Elements/Progetti/s4fgel/src/Model/FintelUtility/Rateizzazione/Manager/RateizzazioneManager.php -n 456
[38952] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="42" id="389520413" resolved="unresolved"></response>

[38952] [Step Debug] <- breakpoint_set -i 43 -t line -f file:///media/leandro/Elements/Progetti/s4fgel/src/Model/FintelUtility/Rateizzazione/Manager/RateizzazioneManager.php -n 428
[38952] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="43" id="389520414" resolved="unresolved"></response>

[38952] [Step Debug] <- breakpoint_set -i 44 -t line -f file:///media/leandro/Elements/Progetti/s4fgel/src/Model/FintelUtility/Rateizzazione/Manager/RateizzazioneManager.php -n 413
[38952] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="44" id="389520415" resolved="unresolved"></response>

[38952] [Step Debug] <- breakpoint_set -i 45 -t line -f file:///media/leandro/Elements/Progetti/s4fgel/src/Model/FintelUtility/Rateizzazione/Manager/RateizzazioneManager.php -n 415
[38952] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="45" id="389520416" resolved="unresolved"></response>

[38952] [Step Debug] <- breakpoint_set -i 46 -t line -f file:///media/leandro/Elements/Progetti/s4fgel/src/Model/FintelUtility/Rateizzazione/Manager/RateizzazioneManager.php -n 464
[38952] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="46" id="389520417" resolved="unresolved"></response>

[38952] [Step Debug] <- breakpoint_set -i 47 -t line -f file:///media/leandro/Elements/Progetti/s4fgel/src/Model/FintelUtility/Rateizzazione/Manager/RateizzazioneManager.php -n 470
[38952] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="47" id="389520418" resolved="unresolved"></response>

[38952] [Step Debug] <- breakpoint_set -i 48 -t line -f file:///media/leandro/Elements/Progetti/s4fgel/src/Model/FintelUtility/Rateizzazione/Manager/RateizzazioneManager.php -n 433
[38952] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="48" id="389520419" resolved="unresolved"></response>

[38952] [Step Debug] <- breakpoint_set -i 49 -t line -f file:///media/leandro/Elements/Progetti/s4fgel/src/Model/FintelUtility/Rateizzazione/Manager/RateizzazioneManager.php -n 434
[38952] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="49" id="389520420" resolved="unresolved"></response>

[38952] [Step Debug] <- stack_get -i 50
[38952] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="stack_get" transaction_id="50"><stack where="{main}" level="0" type="file" filename="file:///home/leandro/.symfony/php/7156db8ed3dfc7f503f23103615bf450f5f1947e-router.php" lineno="12"></stack></response>

[38952] [Step Debug] <- stack_get -i 51
[38952] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="stack_get" transaction_id="51"><stack where="{main}" level="0" type="file" filename="file:///home/leandro/.symfony/php/7156db8ed3dfc7f503f23103615bf450f5f1947e-router.php" lineno="12"></stack></response>

[38952] [Step Debug] <- context_names -i 52
[38952] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="context_names" transaction_id="52"><context name="Locals" id="0"></context><context name="Superglobals" id="1"></context><context name="User defined constants" id="2"></context></response>

[38952] [Step Debug] <- eval -i 53 -- JEdMT0JBTFNbJ0lERV9FVkFMX0NBQ0hFJ11bJzZiYjY5Y2NmLTBmMjEtNDY5Zi1hNGZhLWJhODBhNzM4MzAxYSddPSR0aGlzLT5pYU1Q
[38952] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="eval" transaction_id="53" status="break" reason="ok"><error code="206"><message><![CDATA[error evaluating code]]></message></error></response>

[38952] [Step Debug] <- eval -i 54 -- JEdMT0JBTFNbJ0lERV9FVkFMX0NBQ0hFJ11bJ2VmMTRjODFkLWEwYjQtNDZmMy04NThjLTRiYjQ3NzkxY2JlOSddPSRmYXR0dXJhRmdkLT5nZXRJbXBvcnRvQXBlcnRvTWF0ZXJpYVByaW1hUmVhbGUoKQ==
[38952] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="eval" transaction_id="54" status="break" reason="ok"><error code="206"><message><![CDATA[error evaluating code]]></message></error></response>

[38952] [Step Debug] <- eval -i 55 -- JEdMT0JBTFNbJ0lERV9FVkFMX0NBQ0hFJ11bJ2M0MGFkMmM1LTAwZDMtNDc5MC04MmM5LTJiZTQ0NDJmMzBjNSddPSRpbXBvcnRvUmF0YUNvbnN1bWF0bw==
[38952] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="eval" transaction_id="55"><property type="null"></property></response>

[38952] [Step Debug] <- eval -i 56 -- JEdMT0JBTFNbJ0lERV9FVkFMX0NBQ0hFJ11bJ2Y4ZTJmMjk4LTZlZmMtNDkxNC05MmRiLWMwMWNmMGFhOTAxMSddPSRpbXBvcnRvUmF0YQ==
[38952] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="eval" transaction_id="56"><property type="null"></property></response>

[38952] [Step Debug] <- eval -i 57 -- JEdMT0JBTFNbJ0lERV9FVkFMX0NBQ0hFJ11bJzhlOTI2MzQ3LTBjZTYtNDhiMS1hN2JjLWFmNTFlMGYxYjMxMCddPSR0aGlzLT5pYUNS
[38952] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="eval" transaction_id="57" status="break" reason="ok"><error code="206"><message><![CDATA[error evaluating code]]></message></error></response>

[38952] [Step Debug] <- eval -i 58 -- JEdMT0JBTFNbJ0lERV9FVkFMX0NBQ0hFJ11bJzIxZjZlODdkLTRhNjktNDQ0ZS1hZjQ0LTNlMjVhNDVlODU4ZSddPSRpbnRlcmVzc2k=
[38952] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="eval" transaction_id="58"><property type="null"></property></response>

[38952] [Step Debug] <- eval -i 59 -- JEdMT0JBTFNbJ0lERV9FVkFMX0NBQ0hFJ11bJzAyMDE5NWIxLTRlOWUtNGMxZi04MmMwLTdiMDJiZTU0ODNhMCddPSRyYXRhLT5nZXRJbnRlcmVzc2koKQ==
[38952] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="eval" transaction_id="59" status="break" reason="ok"><error code="206"><message><![CDATA[error evaluating code]]></message></error></response>

[38952] [Step Debug] <- context_get -i 60 -d 0 -c 0
[38952] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="context_get" transaction_id="60" context="0"><property name="$IDE_EVAL_CACHE" fullname="$IDE_EVAL_CACHE" type="array" children="1" numchildren="3" page="0" pagesize="100"><property name="c40ad2c5-00d3-4790-82c9-2be4442f30c5" fullname="$IDE_EVAL_CACHE[&quot;c40ad2c5-00d3-4790-82c9-2be4442f30c5&quot;]" type="null"></property><property name="f8e2f298-6efc-4914-92db-c01cf0aa9011" fullname="$IDE_EVAL_CACHE[&quot
[38952] [Step Debug] <- context_get -i 61 -d 0 -c 1
[38952] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="context_get" transaction_id="61" context="1"><property name="$_COOKIE" fullname="$_COOKIE" type="array" children="1" numchildren="2" page="0" pagesize="100"><property name="XDEBUG_SESSION" fullname="$_COOKIE[&quot;XDEBUG_SESSION&quot;]" type="string" size="8" encoding="base64"><![CDATA[UEhQU1RPUk0=]]></property><property name="PHPSESSID" fullname="$_COOKIE[&quot;PHPSESSID&quot;]" type="string" size="26" enc
[38952] [Step Debug] <- context_get -i 62 -d 0 -c 2
[38952] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="context_get" transaction_id="62" context="2"></response>

  1. 展示 xdebug_info() 的输出(以与您尝试调试的方式相同进行捕获:CLI 或网页)。这是为了检查预期的配置是否与实际匹配。
  2. 启用 Xdebug 日志并尝试调试。然后查看/分享日志 -- 它将告诉您它尝试连接到哪里以及响应是什么等信息。
- undefined
1
  1. 你的 Xdebug 设置(截图)显示 xdebug.log 是空的 - 你在此之后重新启动了 PHP/服务器吗?
  2. 可能是你/其他人没有发送任何“debug me” Xdebug 标志。尝试使用 xdebug.start_with_request = yes 选项(将尝试调试每个请求,无论是否有“debug me”标志)。你需要 Xdebug 日志。
- undefined
@LazyOne 抱歉,那是一张旧图片,我正在更新为新的(文件xdeug.log已创建) - undefined
1
@LazyOne xdebug.start_with_request = yes 这就是诀窍!谢谢...但是我如何只配置“start”与“debug”一起使用呢? - undefined
1
听起来你没有正确使用浏览器的Xdebug扩展。我的意思是,Xdebug没有看到“debug me” cookie。这是在你从浏览器启动调试会话时发生的情况。 - undefined
显示剩余7条评论
2个回答

10

好的,最终我发现使用 symfony server:start 命令会在 /home/user/.symfony/php 文件夹内创建一个临时路由(这里的 "user" 是一种 "约定" )。

这意味着在 PhpStorm 中,您必须在 "外部连接" 下启用 "在 PHP 脚本的第一行处中断" 选项。

enter image description here

这是因为所创建的路由与项目相关联的是外部资源。

没有可行的映射解决方法。

这里 有一个问题已经被提出。

所以,如果您启动了本地 PHP 内置 Web 服务器,则暂时可以使所有操作都正常工作。

cd /path/to/symfony_project/pulic
php -S localhost:8000

这里是安装 php v7.4Symfony 5.2 的完整步骤:


1 - 安装 XDEBUG

在我的情况中,安装的是 XDEBUG v3.0.1。

sudo apt install xdebug

检查是否已安装,使用php -v命令。


2 - 配置XDEBUG 找到您的xdebug.ini文件,在我的情况下位于/etc/php/7.4/mods-available/xdebug.ini,并进行配置。

zend_extension=xdebug.so
xdebug.remote = debug
xdebug.client_port = 9003
# It can be overridden with parameters but in default mode i want this using only PHPSTORM
xdebug.idekey=*PHPSTORM*
# Optional if you want a log
# xdebug.log=/path/to/xdebug.log

3 - 安装浏览器扩展

请在这里查看适用于您浏览器的扩展。 右键单击扩展并将Ide Key设置为PHPSTORM,然后单击“调试”按钮。

输入图像描述

4 - 启动本地Web服务器

如我所说,我使用了内置的php服务器。
cd /path/to/symfony_project/pulic
php -S localhost:8000

5 - 用Phpstorm检查配置

在IDE中,选择Run > Web Server Debug Validation

enter image description here

第一个参数应该是指向你的公共文件夹的路径,然后点击Validate


6 - 开始调试

好了,现在设置一些断点,然后开始调试你的应用程序。


回复:关于路径映射的问题:我们已经尝试将其添加为外部库。我们应该尝试其他方法。不过,既然你已经使其正常工作了,那就由你决定,但是检查这个应该不会花费太多时间。1)从“PHP | Includes”中删除额外的条目;2)使用“添加内容根”按钮在“目录”中添加(相同的路径);3)启动Symfony的Web服务器;4)在PhpStorm中点击“从磁盘重新加载”,以便它可以检测到新创建的路由文件;5)尝试进行调试。 - undefined
这个想法是:IDE似乎不将“PHP | Includes”中的路径视为项目的一部分(至少对于调试入口来说是有道理的;如果你考虑到它在其他方面如TODO、运行检查等方面的工作方式,那么这是有意义的),所以将该文件夹作为项目的实际部分应该会有所帮助(项目本身是一个内容根目录;在这里我们只是添加了另一个根目录)。显然,尝试在几个页面上进行操作,而不仅仅是一个页面。 - undefined
@LazyOne 我会尽快尝试,一旦我解决了导致我设置调试器系统的问题 :D - undefined
我觉得我已经做了一切。我安装了浏览器扩展并在特定标签页上启用了它,我在PHPStorm中设置了“在第一行断点”,我使用相同的PHP和Symfony版本,Web服务器调试验证只显示绿色勾号。但是当我通过浏览器发出请求时,什么都没有发生。一个区别是我使用的是Windows系统,所以我需要通过symfony server:start来启动服务器,而不是使用php -S命令,因为后者会显示“在此服务器上找不到请求的资源”。你认为这个有关系吗?还是我可能忘记了其他什么事情? - undefined
刚刚发现我也有XDebug 2.8.1,但它在Symfony 4.4上使用bin/console启动服务器时运行得很好。 - undefined

0

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接