在宅基地执行Symfony的控制台命令时,Xdebug的不工作

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

当执行bin/console cache:clear调试将不会停止的第一行代码。

下面的输出显示在Xdebug的日志。

[18806] Log opened at 2019-02-04 15:58:42
[18806] I: Checking remote connect back address.
[18806] I: Checking header 'HTTP_X_FORWARDED_FOR'.
[18806] I: Checking header 'REMOTE_ADDR'.
[18806] W: Remote address not found, connecting to configured address/port: 10.0.2.2:9000. :-|
[18806] I: Connected to client. :-)
[18806] -> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///home/vagrant/projects/valkplanner2/bin/console" language="PHP" xdebug:language_version="7.3.0RC3" protocol_version="1.0" appid="18806" idekey="PHPSTORM"><engine version="2.7.0beta1"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[https://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2018 by Derick Rethans]]></copyright></init>
[18806]

我使用PhpStorm 2018年3月3日。以下是我的PhpStorm调试配置:enter image description here

这是/etc/php/7.3/cli/php.ini的Xdebug的配置。

[xdebug]
xdebug.remote_enable=1
xdebug.remote_log="/home/vagrant/xdebug.log"
xdebug.remote_handler=dbgp
xdebug.collect_params=1
xdebug.remote_connect_back=0
;use `route -n` to find dev machine IP address from homestead environment (seems to default to 10.0.2.2)
xdebug.remote_host="10.0.2.2"
xdebug.default_enable=1
xdebug.remote_autostart=1
xdebug.show_local_vars=1
xdebug.profiler_enable=1
xdebug.profiler_output_dir='/home/vagrant/profile'
xdebug.idekey=PHPSTORM

当我使用的URL或Chrome的插件调试器的?XDEBUG_SESSION_START=PHPSTORM浏览器或邮差请求调试工作得很好。

日志建议用Xdebug的工作沟通,但PhpStorm没有反应。

有谁知道是什么问题?

vagrant phpstorm xdebug symfony4 homestead
1个回答
2
投票

听起来像其他服务监听Xdebug的端口而不是PhpStorm上。

在Mac上,如果Xdebug的端口已被其他服务或没有(https://youtrack.jetbrains.com/issue/WI-29443)PhpStorm无法检测。

您可以使用sudo lsof -nP -iTCP -sTCP:LISTEN sort命令来看看该服务可能。最有可能将PHP-FPM(因为它使用TCP端口9000默认情况下)。在Mac和Linux,PHP-FPM很可能将您的开发机器上安装(通常被用PHP一起安装)。

解决方案:改变从默认9000 Xdebug的端口到一些其他端口,通常它也不过下一个 - 9001。做它在这两个php.ini并PhpStorm(确保它不会听的那一刻调试连接;如果这样做,停止和重新启动)。如果您使用的是一些网络服务器(例如Apache)的,你可能需要重新启动,以及(对于PHP读取新的配置)。

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