Reputation: 551
I think I've read through every Xdebug not working question but I cannot seem to get Xdebug to connect to VS Code.
I'm serving a Laravel application on a fresh install of XAMPP PHP 7.2 for Win32. I overwrote the public/index.php
file to just:
<?php
/**
* Laravel - A PHP Framework For Web Artisans
*
* @package Laravel
* @author Taylor Otwell <[email protected]>
*/
phpinfo();
... with a breakpoint set on the last line with phpinfo()
.
Here is my VSCode launch.json:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9000
},
{
"name": "Launch currently open script",
"type": "php",
"request": "launch",
"program": "${file}",
"cwd": "${fileDirname}",
"port": 9000
}
]
}
I changed the Apache server root also but I don't know if that makes a difference (httpd.conf
):
DocumentRoot "D:/xampp/htdocs/simple-budget/public"
<Directory "D:/xampp/htdocs/simple-budget/public">
And finally the tail end of my php.ini
(nothing else altered except for enabled pgsql extension) file configuration (copied from multiple issues similar to this one to no avail):
[XDEBUG]
zend_extension = "D:\\xampp\\php\\ext\\php_xdebug-2.6.0-7.2-vc15.dll"
xdebug.remote_enabled=1
xdebug.remote_autostart=1
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
What am I missing here? I've restarted Apache a million times to make sure. Added the debug extension to Firefox even though autostart is enabled.
Edit:
Xdebug does show up in my phpinfo() page.
Version 2.6.0
IDE Key colesam
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 C:\Windows\Temp C:\Windows\Temp
xdebug.gc_stats_output_name gcstats.%p gcstats.%p
xdebug.halt_level 0 0
xdebug.idekey no value no value
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 C:\Windows\Temp C:\Windows\Temp
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 Off Off
xdebug.remote_handler dbgp dbgp
xdebug.remote_host 127.0.0.1 127.0.0.1
xdebug.remote_log no value no value
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 C:\Windows\Temp C:\Windows\Temp
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
I don't know why the IDE key is colesam but none of the solutions I found for VS Code had to do with the IDE key.
Upvotes: 1
Views: 1174
Reputation: 7461
I know this is old, but for the record, it looks like you have xdebug.remote_enabled=1
in your config, it should be xdebug.remote_enable=1
.
This is born out by your phpinfo output:
xdebug.remote_enable Off Off
However, your post helped me get over my hump, I had remote_autostart
off (default value in fresh install on Fedora 33 from remi repo), turning that on got my VSCode debugger connection working :)
Upvotes: 0
Reputation: 31
I had also problem to connect VS code and XDebug ( PHP / XAMPP ) , trying everything ( PHP.INI settings, launch.json, admin rights, firewall ). At the end I have added PHP installation directory to the windows Path variable. From this moment, everything works fine ...
Not sure if this is exactly the case, but can be one of the reasons.
Upvotes: 1