问题 PHPStorm无法与xdebug建立外部连接


我的操作系统是Mac Mountain lion。

我的PhpStorm版本是5.0.4。

这是我的php xdebug信息:

  • xdebug.remote_autostart => Off => Off
  • xdebug.remote_connect_back => Off => Off
  • xdebug.remote_cookie_expire_time => 3600 => 3600
  • xdebug.remote_enable => On => On
  • xdebug.remote_handler => dbgp => dbgp
  • xdebug.remote_host => 127.0.0.1 => 127.0.0.1
  • xdebug.remote_log => data / logs / xdebug.log => data / logs / xdebug.log
  • xdebug.remote_mode => req => req
  • xdebug.remote_port => 9000 => 9000
  • xdebug.idekey =>没有值=>没有值

我可以在PhpStorm中调试PhpScript Run Type,它运行正常。所以我认为xdebug配置得很好。

但是在我尝试按照“零配置调试”(使用Web应用程序运行类型)后,Phpstorm无法连接传入连接。

这是我的步骤:

  1. 单击开始Listion Php Connection。(将呼叫切换为绿色)
  2. 在PhpScript中单击第一行的Run-> Break,并在第一个语句处设置断点。
  3. 选择My WebApplication Config,然后单击Debug按钮。然后启动chrome并链接到我的phpscript。(使用?XDEBUG_SESSION_START = 19869)
  4. 在PhpStorm中,调试器显示等待与ide键'19869'的传入连接。
  5. 在期刊中,打印lsof -i4TCP:9000

    命令PID用户FD类型设备大小/关闭节点名称
      webide 288 wangfeng 69u IPv6 0xa83881cdce30c579 0t0 TCP *:cslistener(LISTEN)

  6. 打开Chrome的开发者工具,选择Cookie。


8866
2018-01-30 04:50


起源

启用 xdebug.remote_log 可以为您提供更多细节。 - CrazyCoder
是的,我已经设置了它。但没有记录。 - user890973
data/logs/xdebug.log  - 我不是Mac用户,所以只是一个建议:1)使用 充分 路径(从根目录)2)确保它是可写的。但最有可能的问题是xdebug不适用于IPv6 - 你需要IPv4 - LazyOne
1)我的路径已经设置为完全.2)我已经完成了permision.3。我如何配置?请告诉我,非常感谢你! - user890973
正如我已经提到的“我不是Mac用户”,因此我不知道解决方案。你想让我为你谷歌吗? 附: 我当然可以证实这一点 xdebug需要TCP v4而不是v6  - xdebug作者几次说过,最近提到我找到的是不到一年前做的。 - LazyOne


答案:


某些其他进程可能正在使用端口9000。

  1. 在php.ini中设置 xdebug.remote_port=9001 或您选择的其他未使用的端口。
  2. 在PHPStorm中,转到Settings-> PHP-> Debug,在Xdebug部分下,将Debug端口设置为9001。
  3. 重新启动Web服务器。
  4. 开始调试。

14
2018-03-29 07:10



你救了我的命,非常感谢你 - jerson
@jerson不用担心。当我遇到同样的问题时,这是一种痛苦。 - rexposadas


检查完php.ini文件和IDE中的所有配置后,不要忘记添加基本上通过IDE Key通过IDE进行通信的特定于浏览器的扩展。

请参考这个 链接 


1
2018-05-09 19:07