martomo / SublimeTextXdebug

Xdebug debugger client for Sublime Text
MIT License
564 stars 89 forks source link

Unable to get Xdebug to work #97

Closed kamranahmedse closed 7 years ago

kamranahmedse commented 10 years ago

I have just installed xdebug on my sublime text 3. I am using Ubuntu 14.04. I have setup the php.ini after installing the xdebug like the following:

# Added for xdebug
zend_extension="/usr/lib/php5/20121212+lfs/xdebug.so"
xdebug.remote_enable=1
xdebug.remote_handler=dbgp 
xdebug.remote_mode=req
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9010

My project-settings look like the following:

{
    "folders":
    [
        {
            "follow_symlinks": true,
            "path": "."
        }
    ],
    "settings":
    {
        "xdebug":
        {
            "url": "http://localhost/project"
        }
    }
}

But when I tried to debug, it didn't. I have tried the following URLs: http://localhost/project?XDEBUG_SESSION_START=1 http://localhost/project?XDEBUG_SESSION_START=sublime.xdebug

but none of these are working. Later on when I checked the sublime console i.e. by ctrl+` I found out that there were following errors:

Exception in thread Thread-39:
Traceback (most recent call last):
  File "xdebug.protocol in /home/kamran/.config/sublime-text-3/Installed Packages/Xdebug Client.sublime-package", line 244, in listen
OSError: [Errno 98] Address already in use

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "X/threading.py", line 639, in _bootstrap_inner
  File "X/threading.py", line 596, in run
  File "main in /home/kamran/.config/sublime-text-3/Installed Packages/Xdebug Client.sublime-package", line 275, in listen
  File "xdebug.protocol in /home/kamran/.config/sublime-text-3/Installed Packages/Xdebug Client.sublime-package", line 250, in listen
Xdebug Client.xdebug.protocol.ProtocolConnectionException: [Errno 98] Address already in use

I thought that, it might be the reason that the port is being used by some other service, so I tried with the ports between 9000-9010 but none of them seemed to work. Any solutions, how may I get it to work?

flackjap commented 9 years ago

Hey, I ran into the same problem. Have you solved it? Any workarounds?

kamranahmedse commented 9 years ago

@flackjap nope. I didn't try. This article on sitepoint might help though.

flackjap commented 9 years ago

Thnx, but I found out what was the problem for me (maybe not the same problem with your setup). My Xdebug wasn't even running. Somehow I misunderstood the config guides and inserted config params in CLI/php.ini and not the web server's which actually executes Xdebug along with php ...

kamranahmedse commented 9 years ago

Seems like I did the same too.

I have setup the php.ini after installing the xdebug like the following:

# Added for xdebug
zend_extension="/usr/lib/php5/20121212+lfs/xdebug.so"
xdebug.remote_enable=1
xdebug.remote_handler=dbgp 
xdebug.remote_mode=req
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9010

I will give it a try with server config and see if I can get this to work. Thanks.

pierreuh commented 9 years ago

The issue for was the Sublime Xdebug configuration file port. It might sound silly but be sure that you are using the same port in your xdebug.ini file and the Xdebug.sublime-settings

dagomar commented 8 years ago

I have the same issue. I have a clean install of sublime with only xdebug installed.

My php.ini:

zend_extension=/usr/lib/php5/20131226/xdebug.so xdebug.remote_enable=1 xdebug.remote_handler=dbgp xdebug.remote_mode=req xdebug.remote_host=127.0.0.1 xdebug.remote_port=9010

Sublime settings:

{ "ide_key": "sublime-xdebug",

// Window layout that is being used when debugging. "debug_layout" : { "cols": [0.0, 0.5, 1.0], "rows": [0.0, 0.7, 1.0], "cells": [[0, 0, 2, 1], [0, 1, 1, 2], [1, 1, 2, 2]] },

// Group and index positions for debug views. "breakpoint_group": 2, "breakpoint_index": 1, "context_group": 1, "context_index": 0, "stack_group": 2, "stack_index": 0, "watch_group": 1, "watch_index": 1,

"super_globals": true, "close_on_stop": true, "port": 9010, "debug": true }

Console message:

Traceback (most recent call last): File "./threading.py", line 901, in _bootstrap_inner File "./threading.py", line 858, in run File "main in /home/yadieyadayada/.config/sublime-text-3/Installed Packages/Xdebug Client.sublime-package", line 275, in listen File "xdebug.protocol in /home/yadieyadayada/.config/sublime-text-3/Installed Packages/Xdebug Client.sublime-package", line 250, in listen Xdebug Client.xdebug.protocol.ProtocolConnectionException: [Errno 98] Address already in use

Any help greatly appreciated, this is really bugging me (pun intended)

(edit: formatting)

danielkalen commented 8 years ago

Your log output indicates that the port you provided is already in use. Try something random such as 9312 (both in sublime settings and your xdebug.ini file).

Xdebug Client.xdebug.protocol.ProtocolConnectionException: [Errno 98] Address already in use

kamranahmedse commented 7 years ago

But then I wrote

I tried with the ports between 9000-9010 but none of them seemed to work

Anyways, I have been using PhpStorm now. Considering that I used to make some foolish mistakes at that time; I would probably not have tried with matching ports for xdebug and sublime ..so closing :)