调试无法启动

时间:2012-12-25 18:59:31

标签: php sublimetext2 lamp xdebug sublimetext

更新

我花了太多时间在这上面,并决定抛弃它并继续使用笨重的NetBeans。

原始问题:

我在使xdebug处理sublime text 2时遇到了一些困难。

到目前为止我所做的是安装:

  1. LAMP,
  2. 的php5-Xdebug的
  3. python2.6的
  4. 升华文本-2
  5. sublimexdebug
  6. 如果我然后使用sublime打开一个php文件并按shift + f8,会弹出xdebug菜单,我可以add/remove breakpoint以及start debugging

    一些php: Some php

    当我按shift + f8时,菜单会下降: Menu drops down when I press shift+f8

    调试已开始:

    enter image description here

    在那张照片中,它说:

    Xdebug: No URL defined in project settings file
    

    Info.sublime-project包含:

    {
        "folders":
        [
            {
                "path": "/var/www"
            }
        ],
    
        "settings": {
            "xdebug": { "url": "http://localhost" }
        }
    }
    

    从第3张截图中可以看出,我已经开始调试,没有任何反应,没有错误,没有打开浏览器窗口,什么都没有。如果我手动导航到localhost/info.php,页面会正常加载。如果我手动将?XDEBUG_SESSION_START=sublime.xdebug添加到网址末尾localhost/info.php?XDEBUG_SESSION_START=sublime.xdebug并在浏览器上点击刷新,则网页会正常加载,调试仍无法启动。

    我做错了什么?

    更新:有关端口的一些信息:

    在尝试通过sublime text 2启动xdebug之前

    oshirowanen@ubuntu:~$ netstat -antp
    (Not all processes could be identified, non-owned process info
     will not be shown, you would have to be root to see it all.)
    Active Internet connections (servers and established)
    Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
    tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      -               
    tcp        0      0 127.0.0.1:53            0.0.0.0:*               LISTEN      -               
    tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      -                 
    tcp        0      0 90.190.20.220:54913     90.180.80.70:443        ESTABLISHED 2439/python     
    tcp        0      0 90.190.20.220:51727     190.40.210.160:443      TIME_WAIT   -               
    tcp        1      0 90.190.20.220:50967     90.180.90.20:80         CLOSE_WAIT  2349/ubuntu-geoip-p
    tcp6       0      0 :::80                   :::*                    LISTEN      -               
    oshirowanen@ubuntu:~$ 
    

    手动启动铬并通过sublime text 2

    启动xdebug
    oshirowanen@ubuntu:~$ netstat -antp
    (Not all processes could be identified, non-owned process info
     will not be shown, you would have to be root to see it all.)
    Active Internet connections (servers and established)
    Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
    tcp        0      0 0.0.0.0:17500           0.0.0.0:*               LISTEN      2241/dropbox    
    tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      -               
    tcp        0      0 127.0.0.1:53            0.0.0.0:*               LISTEN      -               
    tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      -               
    tcp        0      0 127.0.0.1:59424         127.0.0.1:80            ESTABLISHED 2924/chromium-brows
    tcp        0      0 127.0.0.1:43123         127.0.0.1:9000          ESTABLISHED -               
    tcp        0      0 127.0.0.1:9000          127.0.0.1:43123         ESTABLISHED 2903/sublime_text
    tcp        0      0 90.190.20.220:40809     170.190.40.70:443       ESTABLISHED 2924/chromium-brows
    tcp        0      0 90.190.20.220:54913     90.180.80.70:443        ESTABLISHED 2439/python     
    tcp        0      0 90.190.20.220:43900     170.190.70.90:443       ESTABLISHED 2924/chromium-brows
    tcp        0      0 90.190.20.220:35259     170.190.70.100:443      ESTABLISHED 2924/chromium-brows
    tcp        0      0 127.0.0.1:59426         127.0.0.1:80            TIME_WAIT   -               
    tcp        0      0 90.190.20.220:37922     170.190.70.90:443       ESTABLISHED 2924/chromium-brows
    tcp        1      0 90.190.20.220:50967     90.180.90.20:80         CLOSE_WAIT  2349/ubuntu-geoip-p
    tcp        0      0 90.190.20.220:40847     170.190.40.60:80        ESTABLISHED 2924/chromium-brows
    tcp6       0      0 :::80                   :::*                    LISTEN      -               
    tcp6       0      0 127.0.0.1:80            127.0.0.1:59423         TIME_WAIT   -               
    tcp6       0      0 127.0.0.1:80            127.0.0.1:59424         ESTABLISHED -               
    oshirowanen@ubuntu:~$ 
    

4 个答案:

答案 0 :(得分:1)

一些提示:

  1. 检查Xdebug是否正在运行,检查phpinfo命令生成的信息。

  2. 在xdebug配置中启用远程调试(并使用phpinfo命令再次验证):

    xdebug.remote_enable = 1

  3. 我没有在Sublime Text中使用xdebug设置。我认为没有必要。

  4. 在Sublime Text中打开控制台。控制台中记录了任何问题。在pulgin主页上报告的Ubuntu存在一些问题。

  5. 我使用浏览器扩展来激活或停用调试。在Chrome中寻找“Xdebug Helper for Chrome”。您需要将cookie名称配置为“sublime.xdebug”。

答案 1 :(得分:0)

我使用Easy xDebug for firefox来启动调试会话,这样可以实现魅力。您需要使用“sublime.xdebug”作为idekey。

我认为你在那里有一些断点?您的屏幕截图暗示您这样做,但请确保使用shift + f8菜单添加它们。

答案 2 :(得分:0)

您的配置出现问题,使用了错误的语法(according to Issue #13):

{
    "folders":
    [
        {
            "path": "/var/www"
        }
    ],

    "settings": { <<<==== problem here
        "xdebug": { "url": "http://localhost" }
    }
}

相反它应该是:

{
    "folders":
    [
        {
            "path": "/var/www"
        }
    ],

    "xdebug": 
    {
        "url": "http://localhost" 
    }        
}

这可能也导致它无法正常工作。

答案 3 :(得分:0)

我遇到了同样的问题并在此处提交了错误报告:

https://github.com/Kindari/SublimeXdebug/issues/58

但是,它可能是XDebug本身中与套接字相关的错误:

http://forums.netbeans.org/viewtopic.php?p=141779#141779