Search code examples
phpdebuggingphpstormxdebugremote-debugging

Problems with Xdebug failing to connect with PHPStorm


I'm trying to get Xdebug working with PHPStorm for a Magento site I'm working on.

It is a remote server, and this is my first time setting that up.

As best I can tell it's setup correctly, but when I have PHPStorm Listen it never connects. When I click "Debug" on a remote debug configuration it just stays at "Waiting for an incoming connection with IDE key (the IDE key)".

I don't have a static IP so I've setup xdebug.remote_connect_back. Of course I've turned on the session using both the PHPStorm bookmarklet, and manually adding it to the URL. I've tried different IDE Keys as well. And I always remember to set PHPStorm to listen

So what am I doing wrong?

Some more details:

phpinfo() output related to xdebug:

`xdebug`

    xdebug support  enabled
    Version 2.2.2
    IDE Key PHPSTORM

    Supported protocols Revision
    DBGp - Common DeBuGger Protocol $Revision: 1.145 $

Directive   Local Value Master Value

    xdebug.auto_trace   Off Off
    xdebug.cli_color    0   0
    xdebug.collect_assignments  Off Off
    xdebug.collect_includes On  On
    xdebug.collect_params   0   0
    xdebug.collect_return   Off Off
    xdebug.collect_vars Off Off
    xdebug.coverage_enable  On  On
    xdebug.default_enable   On  On
    xdebug.dump.COOKIE  no value    no value
    xdebug.dump.ENV no value    no value
    xdebug.dump.FILES   no value    no value
    xdebug.dump.GET no value    no value
    xdebug.dump.POST    no value    no value
    xdebug.dump.REQUEST no value    no value
    xdebug.dump.SERVER  no value    no value
    xdebug.dump.SESSION no value    no value
    xdebug.dump_globals On  On
    xdebug.dump_once    On  On
    xdebug.dump_undefined   Off Off
    xdebug.extended_info    On  On
    xdebug.file_link_format no value    no value
    xdebug.idekey   no value    no value
    xdebug.max_nesting_level    100 100
    xdebug.overload_var_dump    On  On
    xdebug.profiler_aggregate   Off Off
    xdebug.profiler_append  Off Off
    xdebug.profiler_enable  Off Off
    xdebug.profiler_enable_trigger  Off Off
    xdebug.profiler_output_dir  /tmp    /tmp
    xdebug.profiler_output_name cachegrind.out.%p   cachegrind.out.%p
    xdebug.remote_autostart Off Off
    xdebug.remote_connect_back  On  On
    xdebug.remote_cookie_expire_time    3600    3600
    xdebug.remote_enable    On  On
    xdebug.remote_handler   dbgp    dbgp
    xdebug.remote_host  localhost   localhost
    xdebug.remote_log   /var/log/xdebug.log /var/log/xdebug.log
    xdebug.remote_mode  req req
    xdebug.remote_port  9000    9000
    xdebug.scream   Off Off
    xdebug.show_exception_trace Off Off
    xdebug.show_local_vars  Off Off
    xdebug.show_mem_delta   Off Off
    xdebug.trace_enable_trigger Off Off
    xdebug.trace_format 0   0
    xdebug.trace_options    0   0
    xdebug.trace_output_dir /tmp    /tmp
    xdebug.trace_output_name    trace.%c    trace.%c
    xdebug.var_display_max_children 128 128
    xdebug.var_display_max_data 512 512
    xdebug.var_display_max_depth    3   3

some screen caps of settings in PHPStorm (sorry, I can't post images yet, or more than 2 links) included screns:

  • interpreters setup
  • Run/Debug configuration
  • Servers (in run/debug)
  • Settings>PHP>Debug
  • Server "Validate Remote Environment"
  • Debug "waiting for incoming connection"

Solution

  • Port 9000 (which I was using) is blocked on the remote server. It took way to long to figure out because I don't have direct access to the server. It was fixed by asking the client to ask their host to remove the block.

    @lazyone 's comment helped me by giving me the link to matthardy.net. That post got me on the right track, and introduced me to the handy tool "canyouseeme.org"