drduh44480 2016-10-17 19:18
浏览 104
已采纳

在WAMP服务器上使用XDebug和SublimeText

I have been hacking away at this for hours, and at one point it was actually working on a test page, but I don't know what happened since then because its stopped working. I've been getting this error a lot:

Error: b'Failed loading c:\wamp\bin\php\php5.6.19\ext\php_xdebug-2.4.1-5.6-vc11.dll '

Its strange because it definitely is loading the file, when I add this to my php.ini file:

zend_extension = "c:\\wamp\\bin\\php\\php5.6.19\\zend_ext\\php_xdebug-2.4.1-5.6-vc11.dll"

it tells that it is indeed enabled. In the php.ini file I spotted this: enter image description here In a tutorial I read, the xdebug.ini file appeared in one of those fields: enter image description here Heres the full settings in my php.ini file:

then check phpinfo() and I now see a section for xdebug: enter image description here

Also when I run

if (xdebug_is_enabled()) { echo 'its enabled'; }

[xdebug]zend_extension = "c:\\wamp\\bin\\php\\php5.6.19\\zend_ext\\php_xdebug-2.4.1-5.6-vc11.dll"
xdebug.remote_enable=1
xdebug.remote_host="localhost"
xdebug.remote_port=9001
xdebug.remote_handler=dbgp
xdebug.remote_autostart=1
xdebug.remote_log= "C:\\wamp\\tmp\\xdebug.log"
xdebug.profiler_enable=0
xdebug.profiler_output_dir = "C:\\wamp\\tmp"
xdebug.collect_params = 4
xdebug.collect_return = on
xdebug.collect_vars = on
xdebug.show_local_vars = 3

I'll be honest, I have no idea what half of those parameters do. Heres the settings for my sublime project:

    "settings":
{
    "xdebug":
    {
        "url": "localhost/xdebug_test"
    },
    "sublime-view-in-browser": {
         "baseUrl": "http://localhost/xdebug_test",
         "basePath": "C:\\wamp\\www\\xdebug_test"
    }
}

and inside XDebug.sublime.settings I added the URL in there:

"url": "http://localhost/xdebug_test"

Heres the index file in the xdebug_test folder:

enter image description here

but when I start the debugger and launch the browser, it instantly echoes test, and nothing appears in the xdebug console: enter image description here It worked on that exact file yesterday, I don't know what could have changed since then.

Is there a way to diagnose whats wrong with it? I don't think so because this isn't just happening in sublime text, heres what happens when I ran a PHP script in the terminal: enter image description here

EDIT: I just spotted in phpinfo() that the IDE Key is set to PHPSTORM. Thats strange because in the xdebug settings file, its set as this:

"ide_key": "sublime.xdebug",

Could that be the issue? Is there anything I can do here to further diagnose the problem?

  • 写回答

4条回答 默认 最新

  • douaoren4402 2016-10-21 16:40
    关注

    I figured out the problem, xdebug was connecting to the wrong port. I found the log file in C:/wamp/tmp/xdebug.log and checked out the latest messages, and there were loads of lines saying the same thing:

    Log opened at 2016-10-21 16:09:25 I: Connecting to configured address/port: localhost:9001. E: Time-out connecting to client. :-( Log closed at 2016-10-21 16:09:26

    I suspected the issue was with the port, I checked the php.ini file and it was set to 9001, then I checked Xdebug.sublime-settings and noticed the port was set to 9000. I set the port in php.ini to 9000 and now xdebug is working.

    I still don't know why its giving me those errors about not being able to load the extension. Strange because it definitely is loading them.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥100 有偿,谁有移远的EC200S固件和最新的Qflsh工具。
  • ¥15 找一个QT页面+目标识别(行人检测)的开源项目
  • ¥15 有没有整苹果智能分拣线上图像数据
  • ¥20 有没有人会这个东西的
  • ¥15 cfx考虑调整“enforce system memory limit”参数的设置
  • ¥30 航迹分离,航迹增强,误差分析
  • ¥15 Chrome Manifest扩展引用Ajax-hook库拦截请求失败
  • ¥15 用Ros中的Topic通讯方式控制小乌龟的速度,走矩形;编写订阅器代码
  • ¥15 LLM accuracy检测
  • ¥15 pycharm添加远程解释器报错