4
votes

I have a PhpStorm project with a remote deployment (Ubuntu Server 16.04) through ssh

PhpStorm Deployment configuration

to test my PHP project I connect to the remote server through a ssh tunnel (putty):

Putty configuration

where the Dynamic Port forwarding D1024 is used for the browser proxy and the Remote Port forwarding R9000 localhost:9000 should be used for XDebug

I configured PhpStorm to use XDebug:

PhpStorm CLI Interpeters Configuration

PhpStorm XDebug configuration

and enabled it to listen PHP Debug Connections:

PhpStorm PHP Debug Enabled

XDebug on remote server seems enabled: PHPInfo1

this is the XDebug section of phpinfo() in my browser

xdebug
xdebug support  enabled
Version 2.6.0
IDE Key XDEBUG_ECLIPSE
Supported protocols
DBGp - Common DeBuGger Protocol
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.filename_format  no value    no value
xdebug.force_display_errors Off Off
xdebug.force_error_reporting    0   0
xdebug.gc_stats_enable  Off Off
xdebug.gc_stats_output_dir  /tmp    /tmp
xdebug.gc_stats_output_name gcstats.%p  gcstats.%p
xdebug.halt_level   0   0
xdebug.idekey   PHPSTORM    PHPSTORM
xdebug.max_nesting_level    256 256
xdebug.max_stack_frames -1  -1
xdebug.overload_var_dump    2   2
xdebug.profiler_aggregate   Off Off
xdebug.profiler_append  Off Off
xdebug.profiler_enable  Off Off
xdebug.profiler_enable_trigger  Off Off
xdebug.profiler_enable_trigger_value    no value    no value
xdebug.profiler_output_dir  /tmp    /tmp
xdebug.profiler_output_name cachegrind.out.%p   cachegrind.out.%p
xdebug.remote_addr_header   no value    no value
xdebug.remote_autostart On  On
xdebug.remote_connect_back  Off Off
xdebug.remote_cookie_expire_time    3600    3600
xdebug.remote_enable    On  On
xdebug.remote_handler   dbgp    dbgp
xdebug.remote_host  127.0.0.1   127.0.0.1
xdebug.remote_log   /var/log/apache2/xdebug.log /var/log/apache2/xdebug.log
xdebug.remote_mode  req req
xdebug.remote_port  9000    9000
xdebug.remote_timeout   200 200
xdebug.scream   Off Off
xdebug.show_error_trace 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_enable_trigger_value   no value    no value
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

and this one is the xdebug grep of php -i from command line:

 php -i | grep xdebug
/etc/php/7.1/cli/conf.d/20-xdebug.ini
xdebug
xdebug support => enabled
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.filename_format => no value => no value
xdebug.force_display_errors => Off => Off
xdebug.force_error_reporting => 0 => 0
xdebug.gc_stats_enable => Off => Off
xdebug.gc_stats_output_dir => /tmp => /tmp
xdebug.gc_stats_output_name => gcstats.%p => gcstats.%p
xdebug.halt_level => 0 => 0
xdebug.idekey => PHPSTORM => PHPSTORM
xdebug.max_nesting_level => 256 => 256
xdebug.max_stack_frames => -1 => -1
xdebug.overload_var_dump => 2 => 2
xdebug.profiler_aggregate => Off => Off
xdebug.profiler_append => Off => Off
xdebug.profiler_enable => Off => Off
xdebug.profiler_enable_trigger => Off => Off
xdebug.profiler_enable_trigger_value => no value => no value
xdebug.profiler_output_dir => /tmp => /tmp
xdebug.profiler_output_name => cachegrind.out.%p => cachegrind.out.%p
xdebug.remote_addr_header => no value => no value
xdebug.remote_autostart => On => On
xdebug.remote_connect_back => Off => Off
xdebug.remote_cookie_expire_time => 3600 => 3600
xdebug.remote_enable => On => On
xdebug.remote_handler => dbgp => dbgp
xdebug.remote_host => 127.0.0.1 => 127.0.0.1
xdebug.remote_log => /var/log/apache2/xdebug.log => /var/log/apache2/xdebug.log
xdebug.remote_mode => req => req
xdebug.remote_port => 9000 => 9000
xdebug.remote_timeout => 200 => 200
xdebug.scream => Off => Off
xdebug.show_error_trace => 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_enable_trigger_value => no value => no value
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

and my browser is sending the correct cookie, as Debug was enabled from Xdebug Helper Firefox extension: Cookie

here's my XDebug configuration in /etc/php/7.1/mods-available/xdebug.ini

zend_extension=xdebug.so
xdebug.remote_enable=1
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_autostart=1
xdebug.idekey="PHPSTORM"

This is the content of xdebug.log

Log opened at 2018-03-23 11:39:26
I: Connecting to configured address/port: locahost:9000.
W: Creating socket for 'locahost:9000', getaddrinfo: No such file or directory.
E: Could not connect to client. :-(
Log closed at 2018-03-23 11:39:26

When I execute my project, navigating it through my browser (ssh tunnel) nothing happens in PhpStorm (even if I set up a breakpoint at the very start of the script)

Where am I wrong?

Maybe the two port forwarding I set in Putty interfere each other? how can I solve this?

1
1) Collect xdebug log -- it will tell what is happening from xdebug side 2) RTFM -- with xdebug.remote_connect_back=On value of xdebug.remote_host is IGNORED and autodetected IP is used (REMOTE_ADDR most likely) .. which not useful in your setup at all. - LazyOne
Docs? xdebug.remote_log - LazyOne
Why it says locahost? 1) You have got a typo there -- it should be localhost (and that's what error says -- it cannot resolve locahost domain) 2) The xdebug settings you have posted clearly use 127.0.0.1 address ... Have you edit it after? 3) Better verify what you have got there from phpinfo() output -- xdebug section -- that one that you have originally posted is pretty useless as it shows only top of the table with least useful settings. - LazyOne
1) So what new xdebug log has to say? 2) Those settings -- are they taken from phpinfo() output captured via browser or console? It has to be the same way as you trying to debug. - LazyOne
What do you mean "nothing new"? is it showing exactly the same log? if so -- something is very wrong in your setup ... Your xdebug settings now show 9001 port. What port is shows in log? Did you setup SSH tunnel to use that 9001 port? I'm sorry .. but mixing old and new info does not help here (as they show different settings). - LazyOne

1 Answers

4
votes

there was a typo in putty tunnel configuration, wrote locahost instead of localhost