【问题标题】:PHP Xdebug log show time-out connection error. Using Atom IDEPHP Xdebug 日志显示超时连接错误。使用 Atom IDE
【发布时间】:2019-08-08 13:43:30
【问题描述】:

我正在为 Atom IDE 使用 XAMPP 和 PHP-Debug 包并下载 xdebug dll 文件。

这是我的 php.ini xdebug:

[xdebug]
zend_extension="C:\xampp\php\ext\php_xdebug-2.7.2-7.3-vc15-x86_64.dll"
xdebug.remote_enable=1
xdebug.remote_host="localhost"
xdebug.remote_connect_back=0    # Not safe for production servers
xdebug.remote_port=9000
xdebug.remote_handler="dbgp"
xdebug.remote_mode=req
xdebug.remote_autostart=1
xdebug.remote_log="C:\Users\mehra\Documents\xdebug.log"

并使用 XAMPP 和 ATOM IDE 运行一个简单的脚本,但我收到此错误:

[12120] Log opened at 2019-08-08 13:36:30
[12120] I: Connecting to configured address/port: localhost:9000.
[12120] E: Time-out connecting to client (Waited: 200 ms). :-(
[12120] Log closed at 2019-08-08 13:36:30
[12120]

我看到有人建议将xdebug.remote_autostart=1 更改为xdebug.remote_autostart=0 并阅读xdebug Time-out connecting to client. :-( using phpstorm 7.1.3/vagrant/virtualbox/magento,但仍然无法正常工作

PHP-调试器设置:

【问题讨论】:

  • 1) 检查防火墙规则——确保允许 Atom(或 Atom 内的调试器包如何工作)接受 TCP 9000 端口上的连接。 2) 让它监听调试连接(我自己不使用 Atom,因此无法给出相关说明),然后使用netstat 或类似工具检查它实际上在 TCP 9000 端口上监听。 3)也许尝试127.0.0.1而不是localhost(有时会有所不同,特别是如果IPv6优先于IPv4)
  • @LazyOne 1) 我关闭了防火墙 2) 我在 atom 网站上阅读了关于此的指南 (atom.io/packages/php-debug) dubegger 配置非常简单,端口 9000(netstat) 3)我把它改成 127.0.0.1 还是不行
  • "并且端口 9000(netstat) 中没有任何内容" 对我来说,这清楚地表明您错过了手册中的某些要点(例如手册中的 #3)。 .. 并且 Atom 还没有监听来自 Xdebug 的传入调试请求。如果它没有在听(无论出于何种原因).. 那么难怪 Xdebug 无法连接。
  • ??为什么你认为这是 Xdebug 问题?我在该链接中看不到任何地方会说“xdebug bug”......我希望您了解 Xdebug(PHP 扩展)和 Php Debug(Atom 的调试扩展)之间的区别。
  • “Atom ide 使用 php debug 和 php debug 使用 xdebug 扩展 php debug 和 xdebug 从 atom 用户的角度来看是相同的” 不。 “Php Debug”是一个 Atom 包 .. 与 Xdebug 一起工作。 Php Debug Atom 包中的错误或错误配置并不意味着 Xdebug PHP 扩展中的错误或错误配置。

标签: php xampp atom-editor xdebug


【解决方案1】:

经过多次尝试,我通过一些改变解决了我的问题:

1-File->Settings->Packages->ide-php

PHP 路径:C:\xampp\php\php.exe

2-php.ini:

zend_extension="C:\xampp\php\ext\php_xdebug.dll"
xdebug.remote_enable=1
xdebug.remote_host=127.0.0.1
xdebug.remote_connect_back=0    # Not safe for production servers
xdebug.remote_port=9000
xdebug.remote_handler="dbgp"
xdebug.remote_mode=req
xdebug.remote_autostart=1
xdebug.remote_log="C:\Users\mehra\Documents\xdebug.log"
xdebug.idekey =xdebug-atom

3-安装 chrome 或 Firefox 的 xdebug helper 扩展:

4-

5-将php-debug包中的路径映射改为[{"remotePath":"C:/xampp/htdocs","localPath":"C:/xampp/htdocs"}]

6-点击 php 调试图标并刷新 Chrome 或 Firefox(在您的代码中使用 alt+F9):

https://www.imprich-create.site/archives/366

【讨论】:

  • 小提示:如果你有xdebug.remote_autostart=1,那么你就不需要Xdebug浏览器助手——有了这个选项,Xdebug将尝试调试每一个请求,不管这种浏览器是否存在Xdebug COOKIE扩展添加。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2020-07-06
  • 1970-01-01
  • 2010-11-26
  • 2012-02-25
  • 2018-04-09
  • 2023-02-05
  • 1970-01-01
相关资源
最近更新 更多