【发布时间】:2016-12-25 22:40:06
【问题描述】:
我正在 sublime 文本中为 php 设置 xdebug,并且 xdebug 不断记录与无法连接相关的错误:
Log opened at 2016-08-18 21:06:01
I: Connecting to configured address/port: localhost:9988.
E: Could not connect to client. :-(
Log closed at 2016-08-18 21:06:01
我希望通过浏览器中的http://localhost:9988 直接进行调试可能会有所帮助,但它只是显示谷歌浏览器错误页面:“本地主机拒绝连接”。也许另一端存在错误,无法将数据推送到 sublime text 客户端,我不知道。当我运行测试/等时,Sublime text xdebug 确实显示消息“Reloading /var/log/xdebug/xdebug.log”,所以它似乎知道正在运行的 php 代码,只是没有进一步了解。
所以,我从没想过我必须调试 xdebug 本身,但是:如何调试 xdebug 到代码编辑器的连接?如果这是 nginx,我会开始调试虚拟主机,但由于它是 xdebug... ...我不知道从哪里开始调试缺少要连接的应用程序?
##各种配置设置##
我在 ubuntu linux 14.04 上。
如果相关的话,这是我的 xdebug.ini 配置文件:
[xdebug]
xdebug.default_enable=1
xdebug.remote_enable=1
xdebug.remote_autostart=1
xdebug.remote_host="localhost"
xdebug.remote_handler="dbgp"
xdebug.remote_port=9988
xdebug.remote_mode = req
xdebug.overload_var_dump=0
xdebug.idekey = sublime.xdebug
xdebug.remote_log="/var/log/xdebug/xdebug.log"
;https://github.com/martomo/SublimeTextXdebug
Xdebug 已安装:
apt-cache policy php-xdebug
php-xdebug:
Installed: 2.4.0-5+donate.sury.org~trusty+1
Candidate: 2.4.0-5+donate.sury.org~trusty+1
Version table:
*** 2.4.0-5+donate.sury.org~trusty+1 0
500 http://ppa.launchpad.net/ondrej/php/ubuntu/ trusty/main amd64 Packages
100 /var/lib/dpkg/status
模块激活:
php -m | grep -i xdebug
xdebug
Xdebug
phpinfo xdebug 设置:
【问题讨论】:
-
可能不重要,但请尝试在 remote_host 属性中的 localhost 之前添加 http://
-
@Glubus 错误消息更改为:日志于 2016-08-22 13:40:28 打开 I:连接到配置的地址/端口:localhost:9988。 E: 无法连接到客户端。 :-( 日志于 2016-08-22 13:40:28 关闭,否则没有区别。
-
你有防火墙会阻止那个端口吗?
-
运行
telnet localhost 9988时会发生什么? -
@axiac 当我远程登录到该端口时连接被拒绝。当我连接到 localhost 端口 80 时,它确实连接(如我所料)我会说应用程序的服务器没有运行,但我不知道 xdebug 的服务器是什么,也不知道它如何指定一个开放端口。 telnet localhost 9988 Trying 127.0.0.1... telnet:无法连接到远程主机:连接被拒绝 $ telnet localhost 80 Trying 127.0.0.1... 连接到本地主机。转义字符是'^]'。 MikeSimonson:防火墙设置为允许该端口的传入和传出。
标签: php sublimetext3 xdebug sublime-text-plugin