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条)

报告相同问题?

悬赏问题

  • ¥50 永磁型步进电机PID算法
  • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥200 uniapp长期运行卡死问题解决
  • ¥15 latex怎么处理论文引理引用参考文献
  • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?
  • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?