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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
  • dousongqiang2585 2016-10-17 19:22
    关注

    Did you try changing the xdebug url in project settings?

    "xdebug":
    {
        "url": "http://localhost/xdebug_test"
    
    }
    
    评论
  • dongshanyan0322 2016-10-17 19:47
    关注

    What if you use this version of dll - https://xdebug.org/files/php_xdebug-2.4.1-5.6-vc11-nts.dll ? Postfix "nts" means "Non-thread-safe".

    And of course you can use XDebug wizard to find out which dll version and which settings do you need - https://xdebug.org/wizard.php

    评论
  • dongpian6319 2016-10-17 20:25
    关注

    I pasted my info into the wizard and heres what I got enter image description here

    I'll give the non threaded version a try.

    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥15 Qt 不小心删除了自带的类,该怎么办
  • ¥15 我需要在PC端 开两个抖店工作台客户端.(语言-java)
  • ¥15 有没有哪位厉害的人可以用C#可视化呀
  • ¥15 可以帮我看看代码哪里错了吗
  • ¥15 设计一个成绩管理系统
  • ¥15 PCL注册的选点等函数如何取消注册
  • ¥15 问一下各位,为什么我用蓝牙直接发送模拟输入的数据,接收端显示乱码呢,米思齐软件上usb串口显示正常的字符串呢?
  • ¥15 Python爬虫程序
  • ¥15 crypto 这种的应该怎么找flag?
  • ¥15 代码已写好,求帮我指出错误,有偿!