I am trying to setup xdebug so that I can debug php code on a remote server from PHP storm running on my local laptop.
It's not working but I thought a good place to start fixing the problem would be to look at the xdebug log.
Sadly, the xdebug log file remains empty.
I am trying to test xdebug by running a .php file where the first line is phpinfo()
The result of running the file gives me these lines relating to 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.idekey => PHPSTORM => PHPSTORM
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 => Off => Off
xdebug.remote_cookie_expire_time => 3600 => 3600
xdebug.remote_enable => On => On
xdebug.remote_handler => dbgp => dbgp
xdebug.remote_host => 10.1.12.136 => 10.1.12.136
xdebug.remote_log => /home/mfowler/xdebug.log => /home/mfowler/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
_SERVER["PHP_SELF"] => xdebug_test.php
_SERVER["SCRIPT_NAME"] => xdebug_test.php
_SERVER["SCRIPT_FILENAME"] => xdebug_test.php
_SERVER["PATH_TRANSLATED"] => xdebug_test.php
However /home/mfowler/xdebug.log has nothing in it.
All help appreciated!
Enable Xdebug logging by adding the following line into php. ini: xdebug. remote_log=/log_path/xdebug.
XDebug works over the protocol that requires your local machine to listen for incoming connections from a server where an application you are debugging is located. You may already have used debugging tools that simply connect to a remote server or a process of your application.
You can find it in the extension window and install it. After installation, you must reload the VSCode window. Now, again run phpinfo(); method in any PHP file to check if Xdebug is enabled or not. Now click on the debug console tab and click on add configuration.
Check proper log configuration, I prefer maximum log level:
For Xdebug 2
# always start
xdebug.remote_autostart=true
# log settings
xdebug.remote_log="/tmp/xdebug/xdebug.log"
xdebug.remote_log_level=7
For Xdebug 3
# always start
xdebug.start_with_request=yes
# log settings
xdebug.log="/tmp/xdebug/xdebug.log"
xdebug.log_level=7
Please be sure that log file created and accessed, i.e:
mkdir -p /tmp/xdebug
touch /tmp/xdebug/xdebug.log
chmod 777 /tmp/xdebug/xdebug.log
To check if remote port listening - use telnet:
telnet 10.1.12.136 9000
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With