【发布时间】:2025-12-08 02:15:01
【问题描述】:
我已经在我的 64 位 Win7 机器上成功安装了 Sublime Text 和 xdebug,并在 Firefox 中安装了最简单的 Xdebug 插件。 Sublime Text 以管理员身份运行,它的项目文件设置了正确的路径和 xdebug 设置,并且我只在具有有效 PHP 代码的行上设置断点。 WampServer 在http://localhost:8080/ 上正常运行。
xdebug 包命令看起来像设计的那样工作,但是 调试器永远不会在我的断点处停止。 在 Sublime Text 中启动或停止调试器会在 Firefox 中打开正确的 HTML 页面,尽管页面加载是比平时慢很多。
我已经设置了 xdebug 日志。这是一个示例。
Log opened at 2013-06-23 21:42:02
I: Connecting to configured address/port: localhost:9000.
I: Connected to client. :-)
-> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///C:/wamp/bin/php/firelogger/firelogger.php" language="PHP" protocol_version="1.0" appid="3948" idekey="sublime.xdebug"><engine version="2.2.3"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[http://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2013 by Derick Rethans]]></copyright></init>
<- breakpoint_set -i 1 -n 10 -t line -f file://C:\Users\work\My Projects\ElseApps\EAFF\code\webroot\index.php
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="1"><error code="1"><message><![CDATA[parse error in command]]></message></error></response>
<- breakpoint_set -i 2 -n 17 -t line -f file://C:\Users\work\My Projects\ElseApps\EAFF\code\approot\core\etc\eaff-index.php
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="2"><error code="1"><message><![CDATA[parse error in command]]></message></error></response>
<- breakpoint_set -i 3 -n 18 -t line -f file://C:\Users\work\My Projects\ElseApps\EAFF\code\approot\core\etc\eaff-index.php
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="3"><error code="1"><message><![CDATA[parse error in command]]></message></error></response>
<- run -i 4
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="run" transaction_id="4" status="stopping" reason="ok"></response>
Log closed at 2013-06-23 21:42:04
为了完整起见,这是我的 php.ini 文件的 xdebug 部分...
[xdebug]
zend_extension = c:\wamp\bin\php\php5.3.13\ext\php_xdebug-2.2.3-5.3-vc9-x86_64.dll
;xdebug.remote_enable = off
;xdebug.profiler_enable = off
;xdebug.profiler_enable_trigger = off
;xdebug.profiler_output_name = cachegrind.out.%t.%p
;xdebug.profiler_output_dir = "c:/wamp/tmp"
xdebug.remote_enable=1
xdebug.remote_host="localhost"
xdebug.remote_port=9000
xdebug.remote_handler="dbgp"
xdebug.remote_log=C:\wamp\bin\apache\apache2.2.22\logs\xdebug.log
xdebug.remote_mode=req
xdebug.profiler_enable=1
xdebug.profiler_output_dir="c:/wamp/tmp/"
xdebug.collect_params=On
xdebug.show_local_vars=On
... 和 Sublime Text 项目文件。
{
"folders":
[
{
"path": "/C/Users/work/My Projects/ElseApps/EAFF/code"
}
],
"settings": {
"xdebug": { "url": "http://localhost:8080" }
}
点击开始调试后,Sublime Text的状态栏显示如下信息,页面加载缓慢:
Xdebug: Page finished executing. Reload to continue debugging.
谁能发现我哪里出错了,或者建议一个有用的方法来诊断问题?
【问题讨论】:
-
我刚刚在日志文件中发现了“命令中的解析错误”语句。但是,由于我还不知道这些意味着什么,所以我会让问题保持原样。
-
分析器会使 php 运行速度变慢。
-
我想知道 Sublime Text 包发送到 Xdebug 的路径中有空格是否存在问题。任何人都可以忽略或确认这是“解析错误”的可能原因吗?
标签: php sublimetext2 xdebug