xdebug drives me nuts

Hi,

the last two days, i tried to configure phpStorm 4 and xDebug - without success.

Webserver is
Ubuntu 12.04 LTS
lighttpd/1.4.28 (ssl)
PHP Version => 5.3.10-1ubuntu3
Xdebug v2.1.4 (xdebug was installed with the instruction from here http://xdebug.org/wizard.php)

xdebug-config:

xdebug.remote_enable=1
xdebug.remote_autostart=0
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.idekey=PHPSTORM
xdebug.remote_log="/srv/log/xdebug.log"



Local machine with phpStorm 4.0
OSX 10.7.3
phpStorm 4

I tried:

Case 1


nothing happens.

I try the script from this comment http://youtrack.jetbrains.net/issue/WI-1818#comment=27-207037 with fsockopen('[webserver]', '9001') -> unable to connect to webserver:9001 (Connection refused)
phpStorm Tools > DBGp Proxy -> Register with webserver-ip / webserver-name / localhost / 127.0.0.1  on port 9000 / 9001 and IDE-Key PHPSTORM - nothing


Case 2
I installed pydbgproxy on webserver.

INFO: dbgp.proxy: starting proxy listeners.  appid: 7881
INFO: dbgp.proxy:     dbgp listener on 127.0.0.1:9000
INFO: dbgp.proxy:     IDE listener on  127.0.0.1:9001



I reload the browser

INFO: dbgp.proxy: connection from 127.0.0.1:51042 [<__main__.sessionProxy instance at 0xd233b0>]
WARNING: dbgp.proxy: No server with key [PHPSTORM], stopping request [<__main__.sessionProxy instance at 0xd233b0>]
INFO: dbgp.proxy: session stopped



phpStorm Tools > DBGp Proxy -> Register with webserver-ip / webserver-name / localhost / 127.0.0.1  on port 9000 /9001 and IDE-Key PHPSTORM - nothing

Case 3
ssh tunnel to webserver with ssh -L 9001:localhost:9001 me@webserver.de
phpStorm Tools > DBGp Proxy -> Register with localhost and IDE-Key PHPSTORM -> Xdebug proxy: IDE successfully registered with ide key 'PHPSTORM'
INFO: dbgp.proxy: Server:onConnect ('127.0.0.1', 54281) [proxyinit -p 9000 -k PHPSTORM -m 1]


But
many...

INFO: dbgp.proxy: connection from 127.0.0.1:51527 [<__main__.sessionProxy instance at 0x7f963c073128>]
INFO: dbgp.proxy: connection from 127.0.0.1:51528 [<__main__.sessionProxy instance at 0x7f963c06d050>]
INFO: dbgp.proxy: connection from 127.0.0.1:51529 [<__main__.sessionProxy instance at 0x7f963c069098>]
INFO: dbgp.proxy: connection from 127.0.0.1:51530 [<__main__.sessionProxy instance at 0x7f963c068a70>]
...



and

ERROR: dbgp.proxy: Unable to connect to the server listener 127.0.0.1:9000 [<__main__.sessionProxy instance at 0x7f963c0859e0>]
Traceback (most recent call last):
  File "./pydbgpproxy", line 222, in startServer
  File "/usr/lib/python2.7/socket.py", line 187, in __init__
error: [Errno 24] Too many open files
WARNING: dbgp.proxy: Unable to connect to server with key [PHPSTORM], stopping request [<__main__.sessionProxy instance at 0x7f963c0859e0>]
WARNING: dbgp.proxy: Exception in _cmdloop [[Errno 104] Connection reset by peer]
WARNING: dbgp.proxy: Exception in _cmdloop [[Errno 104] Connection reset by peer]



In phpStorm - nothing happens.

I read somewhere, that it can be problem with ipv6. therefore I disabled ipv6, but nothing changes.


Case 4
I set

xdebug.remote_host = serverIp



and start the proxy with

./pydbgpproxy -i serverIp:9001 -d serverIp:9000



phpStorm Tools > DBGp Proxy with serverIp an 9001 an idekey works

INFO: dbgp.proxy: Server:onConnect ('88.134.8.12', 64011) [proxyinit -p 9000 -k PHPSTORM -m 1]



But if I reload the page, the browser loads eternal and

INFO: dbgp.proxy: connection from 188.165.179.56:42958 [<__main__.sessionProxy instance at 0x7f5704033bd8>] ERROR: dbgp.proxy: Unable to connect to the server listener 88.134.8.12:9000 [<__main__.sessionProxy instance at 0x7f5704033bd8>] Traceback (most recent call last):   File "./pydbgpproxy", line 223, in startServer     self._server.connect((self._serverAddr[0], self._serverAddr[1]))   File "/usr/lib/python2.7/socket.py", line 224, in meth     return getattr(self._sock,name)(*args) error: [Errno 110] Connection timed out WARNING: dbgp.proxy: Unable to connect to server with key [PHPSTORM], stopping request [<__main__.sessionProxy instance at 0x7f5704033bd8>] INFO: dbgp.proxy: session stopped



in phpStorm nothing happens


Can someone help me?
5 comments
Comment actions Permalink

Hi there,

1) You don't need xdebug proxy if you are the only person to connect to it. That's different thing.

2) Where is your web server? Next to you (LAN/Virtual .. or somewhere on Internet). If 2nd -- you may need to setup your router to forward incoming traffic on TCP 9000 (xdebug port number from PhpStorm) to your PC (as it's xdebug who initiates connection).

3) Make sure that PhpStorm actually listen TCP 9000 (xdebug port) on your computer (use netstat or similar to check)

4)

xdebug.remote_host=localhost

If server is not on the same computer as PhpStorm (e.g. another server, even virtual), then you have to put your actual IP here -- unless you are using SSH tunnel

In any case -- you need to check if you are able to connect from your server to your computer on xdebug port -- you can do it with telnet. Activate the "Listen php Debug Button" and try to connect with telnet (use correct remote IP).


So .. for case #1 -- use correct IP address for xdebug.remote_host -- it has to be IP of your PC as it is visible from your server. To check that IP -- write some simple PHP script that will check $_SERVER['REMOTE_ADDR'] and access that script from your PC via browser.

For other cases -- better search this forum for "ssh xdebug proxy" keywords (I'm not expert here to advise anything) -- there were 1 or two topics on that, 1 of them had the solution with some explanation (the guy was describing what he was doing).

0
Comment actions Permalink


hi!


thank you for your fast reply.


els-MacBook-Pro:~ el$ netstat -np TCP 9000             input        (Total)           output    packets  errs      bytes    packets  errs      bytes colls

els-MacBook-Pro:~ el$ netstat -np TCP 9001
            input        (Total)           output
   packets  errs      bytes    packets  errs      bytes colls



I close phpStorm, opend it again, activate and deactivate the debug listening button, but in netstat nothing happens.

0
Comment actions Permalink

It works now without the proxy.
reason was a typo in xdebug-config


zend_extension=/usr/lib/php5/20090626/xdebug.so xdebug.remote_enable=On xdebug.remote_autostart=On xdebug.remote_handler=dbgp xdebug.remote_mode=req xdebug.remote_host=localhost xdebug.remote_port=9000 xdebug.idekey=PHPSTORM xdebug.remote_log="/tmp/xdebug.log"



From my local machine I open an ssh-tunnel

ssh -R 9000:localhost:9000 me@webserver.de

0
Comment actions Permalink

Hi, el,

Thanks for sharing!

Please let us know if you will have an issue with the debugger again.

0
Comment actions Permalink

El,

You have set remote_handler, remote_host, remote_port and remote_mode to their default values. In other words, you can remove those from your ini file.

xdebug.remote_enable=On
xdebug.remote_autostart=On
xdebug.idekey=PHPSTORM
xdebug.remote_log="/tmp/xdebug.log"

Would be enough in your case. You may want to try it without the idekey as well since that works for me.

xdebug is a wonderful product, but terribly confusing to configure (for me at least).

0

Please sign in to leave a comment.