gpt4 book ai didi

symfony - PhpStorm Xdebug Symfony 配置

转载 作者:行者123 更新时间:2023-12-05 08:48:54 27 4
gpt4 key购买 nike

我正在为主题配置而苦苦挣扎

遵循本指南: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

这是我的调试配置

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

并安装了xdebug extension in chrome

我已经在 Controller 中放置了一些 BreakPoint 来检查它是否工作......没有任何反应

如果我尝试验证调试服务器配置,这就是错误

enter image description here

我认为是因为 symfony 中的安全配置,但我也“打开”了子文件夹(公共(public)/测试)的访问权限,但没有成功

有人可以帮我做这个配置吗?谢谢

[编辑]

按照@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 documentation 中所建议,为了验证调试器的配置,但结果是一个空白网页(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>

最佳答案

好吧,最后我发现使用 symfony server:start 客户端在 /home/user/.symfony/php 文件夹中创建了一个临时路由器(用户是这里的“约定”)这意味着在 PhpStorm 中,您必须启用“外部连接”下的“在 PHP 脚本的第一行中断”选项

enter image description here

这是因为创建的路由器相对于项目是外部的。

没有映射解决方法有效。

有一个 issue opened here

所以我暂时发现,如果你启动一个内置于网络服务器的本地 php,它就可以正常工作,所以

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 - 安装浏览器扩展检查here您浏览器的扩展名。右键单击扩展并将 Ide Key 设置为 PHPSTORM,然后单击“调试”。

enter image description here


4 - 启动本地网络服务器正如我所说,我使用内置的 php 服务器,所以

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

5 - 使用 Phpstorm 检查配置

在 IDE 中 运行 > Web 服务器调试验证

enter image description here

第一个参数应该是您的公用文件夹的路径,然后单击验证


6 - 开始调试

就是这样,放置一些断点,然后开始调试您的应用程序

关于symfony - PhpStorm Xdebug Symfony 配置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65326808/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com