Symfony 4 Xdebug无法与REST API一起使用

问题描述 投票:0回答:1

我对Xdebug有问题,就像正确安装所有东西一样,我放置了一个断点,但是什么也没有发生,即,尽管有断点,调试器也不会停止。

我的/etc/php/7.4/apache2/conf.d/20-xdebug.ini配置

zend_extension=/usr/lib/php/20190902/xdebug.so
xdebug.remote_enable = 1
xdebug.remote_port = 9000
xdebug.idekey = PHPSTORM
xdebug.show_error_trace = 1
xdebug.remote_autostart = 0o

当我执行php -v时我得到了:

PHP 7.4.6 (cli) (built: May 14 2020 10:03:28) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.6, Copyright (c), by Zend Technologies
    with Xdebug v2.9.5, Copyright (c) 2002-2020, by Derick Rethans

我的PhpStorm设置:

enter image description here

enter image description here

我在PhpStorm中设置了断点:

enter image description here

我正在使用Symfony 4编写REST API,并使用Postman发送请求,并希望调试代码。

有什么想法吗?如何调试REST API?

symfony postman phpstorm xdebug
1个回答
1
投票

XDEBUg是否运行均不依赖于PHP框架。

我看到一个“ 0o”。将其设置为1。尽管apache不应以“ 0o”开头。

xdebug.remote_autostart = 0o

这是我的XDEBUG配置,但在docker中。

xdebug.default_enable=1
xdebug.remote_enable=1
xdebug.remote_autostart=1
xdebug.remote_handler=dbgp
xdebug.remote_connect_back=0
xdebug.remote_port=9000
# xdebug.remote_host=${IP} # docker

您仍然有:

xdebug.idekey = PHPSTORM

尝试使用?XDEBUG_SESSION_START = PHPSTORM调用端点

运行-> PHP脚本第一行中断处设置复选标记。这样,您可以查看XDEBUG是否有任何反应。

然后请在以下位置配置您的应用程序:运行-> 编辑配置-> 模板-> PHP远程调试

© www.soinside.com 2019 - 2024. All rights reserved.