PhpStorm 2021.2 + PHP 7.4 + Xdebug 3.0, 调试失败
Mac 本地 Laravel 项目,搞了一晚上,实在搞不定了,一直显示 正在等待与ide key ‘xxx’ 的传入连接,求助大家
php -v
✗ php -v
PHP 7.4.16 (cli) (built: Mar 4 2021 20:52:51) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Xdebug v3.0.4, Copyright (c) 2002-2021, by Derick Rethans
with Zend OPcache v7.4.16, Copyright (c), by Zend Technologies
php.ini
[xdebug]
zend_extension="xdebug.so"
xdebug.remote_handler=dbgp
xdebug.start_with_request=yes
xdebug.mode=debug
xdebug.client_host=127.0.0.1
xdebug.client_port=9001
xdebug.log = "/tmp/remote_xdebug.log"
Xdebug_info
PhpStorm配置
service 我配的是 api 地址,不是前端地址
DBGp 代理
debug
验证也成功
调试配置
端口情况
断点代码
点了调试的小虫子,就跳转到浏览器,url 如下
PhpStorm 一直显示:正在等待与ide key ‘xxx’ 的传入连接
Xdegub log
[18769] Log opened at 2021-08-15 06:01:00.204011
[18769] [Step Debug] INFO: Connecting to configured address/port: localhost:9001.
[18769] [Step Debug] INFO: Connected to debugging client: localhost:9001 (through xdebug.client_host/xdebug.client_port). :-)
[18769] [Step Debug] -> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" fileuri="file:///……/lpc-api/artisan" language="PHP" xdebug:language_version="7.4.16" protocol_version="1.0" appid="18769" idekey="PHPSTORM"><engine version="3.0.4"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[https://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2021 by Derick Rethans]]></copyright></init>
[18769] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" status="stopping" reason="ok"></response>
[18769] [Step Debug] WARN: 2021-08-15 06:01:01.018370: There was a problem sending 179 bytes on socket 7: Broken pipe.
[18769] Log closed at 2021-08-15 06:01:01.023200
————————
2021.08.17
最终尝试将 port 改为Xdebug 3 默认 port ,结果就好了……
最终尝试将 port (php.ini 及 PhpStorm 中)改为 Xdebug 3 默认的 port :9003 ,结果就好了,应该是 Nginx 占用了 9001 端口导致的…… 感谢各位
看到这一刻实属不易

另外提示一下将来可能遇到类似问题看到此贴的同学,Xdebug 3 相对于 2 有很多改动。不妨先看一下官方文档,排除配置问题
xdebug 升级指导