PHPSTORM 2017 XDEBUG connection problem

Answered

I totally give up to figure out why my PHPSTORM that runs on win 10 machine can't normally work with remote Xdebug on CentOS. PHP 5.6.

It seems everything is tuned well, but i got an error. I want to debug single file.

Here is my total snapshot of all settings. Could you help me to understand what it could be. Thanks in advance.

xdebug.remote_connect_back i also tried to set both for 1 and for 0, it didn't help.

0
4 comments

Hi there,

>xdebug.remote_connect_back i also tried to set both for 1 and for 0, it didn't help.

Well .. this one (having it set to "1" or "on") should work if you would debug it via browser .. but since you are trying to debug it via SSH (CLI mode) those variables should not be set so it's expected.

 

So ...

1) You are trying to debug your code via direct SSH (CLI mode) and not via browser

2) What is 192.20.125.56? Is that your IP or IP of some another server? based on info from screenshots it's not an IDE IP .. so could be your server IP.

  • This must be your IP (where PhpStorm is running) as seen from the remote server.
  • Make sure that your firewall allows incoming requests on TCP 9000 port (as it's xdebug that connects to IDE and not other way around)

 

You are connected to the server via SSH ... but how a request to that IP goes from the server  -- via the same SSH connection or via standard outgoing interface? Check the routing path for that. (Sorry -- not really a Linux/SSH user here -- have little practical experience with SSH and how it actually works behind the curtain). If it goes via standard route -- make sure that your router allows incoming connection on that port.

Please check this: 1) enable "phone handle" icon in PhpStorm (so it starts listening) 2) try connecting via telnet from your remote server to your PhpStorm on that TCP 9000 port. If you cannot -- there must be some sort of firewall between server and you (can be one on your router (which will usually block almost all incoming requests) or it could be even your server (that allows outgoing connections on certain port ranges only))

3) Since you are doing it via SSH -- maybe you just need to do it via 127.0.0.1 IP ( I'm referring to https://confluence.jetbrains.com/display/PhpStorm/Remote+debugging+in+PhpStorm+via+SSH+tunnel )

 

P.S. I'd debug either via browser (so no SSH at all -- but your router/firewall should allow incoming requests on xdebug port) .. or via SSH tunnel (link in #3) where xdebug connects to 127.0.0.1:9000 and SSH nicely forwards it to your local 9000 port trough the tunnel (so no need to deal with firewall/router)

P.P.S. Side note -- you seem to be trying to debug controller directly (based on your "...\catalog\controller\handlers\xxx.php" info) -- that most likely will fail as your framework (if you are using one) is not yet initialised (as you are calling controller directly and not via bootstrapping/entry point).

1
Avatar
Permanently deleted user

thanks for your reply. yes, i thought that problem is in IP. the fact is that i'm using not real IP and to my surprise different services for determining external IP  show 2 different IP's of mine. cmyip.com shows exactly IP that i use in my php.ini config, but i afraid that i can't reach my local server because of ISP's NAT and grey IP. i think that is the problem

p.s. Debuging in browser also not working

  • Waiting for incoming connection with ide key '11374' - and that's all, nothing happens when browsing
0

>but i afraid that i can't reach my local server because of ISP's NAT and grey IP. i think that is the problem

So it's about grey IP.

In such case I say go with SSH Tunnel: Establish SSH Tunnel before debugging (so you will be using 127.0.0.1 as the IP in php.ini; you may need to use 9001 port in case if you are running php-fpm -- by default it also uses TCP 9000). https://confluence.jetbrains.com/display/PhpStorm/Remote+debugging+in+PhpStorm+via+SSH+tunnel

 

>p.s. Debuging in browser also not working

>Waiting for incoming connection with ide key '11374' - and that's all, nothing happens when browsing

Well... if you have used the same IP and you have grey IP -- it will not work as with your settings it requires direct incoming connection.

I say: use SSH tunnel (to bypass IP issue) and debug via browser (you may use browser extension to set xdebug cookie) https://confluence.jetbrains.com/display/PhpStorm/Debugging+with+PhpStorm.

2
Avatar
Permanently deleted user

thanks, buddy, now it seems everything works fine)

0

Please sign in to leave a comment.