首页 > 解决方案 > PhpStorm 和 Xdebug 的调试问题

问题描述

我正在尝试使用 Xdebug 在 PhpStorm v2019.1.2 中调试 Symfony 4 项目。问题是,每次我启动调试会话时,它都会中断(没有断点)bin/console.php (line 9)

if (false === in_array(\PHP_SAPI, ['cli', 'phpdbg', 'embed'], true)) {
    echo 'Warning: The console should be invoked via the CLI version of PHP, not the '.\PHP_SAPI.' SAPI'.\PHP_EOL;
}

然后在vendor/symfony/web-server-bundle/Resources/router.php (line 25)

if (ini_get('auto_prepend_file') && !in_array(realpath(ini_get('auto_prepend_file')), get_included_files(), true)) {
    require ini_get('auto_prepend_file');
}

在实际输入我的代码并点击我设置的断点之前。

如何修复/防止这种行为?

这是我的 PHP 版本:

PHP 7.3.1(cli)(构建:2019 年 1 月 9 日 22:22:34)(NTS MSVC15(Visual C++ 2017)x64)

版权所有 (c) 1997-2018 PHP 集团

Zend Engine v3.3.1,版权所有 (c) 1998-2018 Zend Technologies

使用 Xdebug v2.7.2,版权所有 (c) 2002-2019,作者 Derick Rethans

这是我的php.inixdebug 部分:

[XDEBUG]
zend_extension = "C:\Program Files\PHP\v7.3\ext\php_xdebug-2.7.2-7.3-vc15-nts-x86_64.dll"
xdebug.remote_autostart=1
xdebug.remote_connect_back=1
xdebug.remote_cookie_expire_time = 3600
xdebug.remote_enable = 1
xdebug.remote_host = localhost
xdebug.remote_port = 9000
xdebug.remote_handler = dbgp
xdebug.remote_log=path_to_log/xdebug.log
xdebug.scream = 0

标签: phpsymfonyphpstormxdebugsymfony4

解决方案


推荐阅读