Flywheel / xDebug / Visual Studio Code

Hi all,

I’m new to debugging and wondering if someone might be able to help - I’m trying to debug my local Wordpress site (Running on Flywheel of course) using Visual Studio Code but am having some trouble seeing variables.

Debugging for the most part looks to be working, I can add breakpoints and it stops the code accordingly, and I can inspect all of the global variables with no problems,

The issue I’m having is I can’t seem to get any of my local variables to show up when debugging. If you consider my function (See attached screenshot) - it defines 2 variables, $hello and $user.

$User shows in the variables panel, but $hello does not.

Here is the xdebug config set in my php.ini;

[Xdebug]
zend_extension = /opt/php/7.2.0/lib/php/extensions/no-debug-non-zts-20170718/xdebug.so
xdebug.remote_autostart=1
xdebug.remote_enable=1
xdebug.remote_connect_back=On
xdebug.remote_port=“9000”
xdebug.profiler_enable=0
xdebug.profiler_enable_trigger = 1
xdebug.profiler_output_dir = /app/profiler
xdebug.scream = 1
xdebug.show_local_vars = 1
xdebug.remote_autostart = 1
xdebug.dump_globals=On
xdebug.collect_params=4
xdebug.show_local_vars=1
xdebug.var_display_max_depth=100
Xdebug.remote_host=192.168.95.100

I’ve also got the Chrome xDebug helper, but it doesn’t seem to do much helping at the moment :slight_smile:

I’m not sure if I have xDebug setup correctly, from what I’ve read Flywheel comes with xDebug installed , I’m not sure how to verify that or update if needed

Any ideas you have would be very much appreciated

Many thanks

Hey @MushroomCat, Welcome to the Community Forums!

That is odd – What happens when you set a break point on line 98 – the echo $hello; line?

I know that PHP doesn’t establish a new variable scope within an if statement, but maybe xDebug makes that kind of distinction?

To clarify – since you are seeing the variables and breakpoints within VSCode, I think it’s safe to assume that things are set up correctly!

Hi Ben, thanks for your reply.

At break point on line 98 it’s the same result, still no trace of the $hello variable. This variable is outside of the if statement too.

So I can’t see how this can be working correctly?

Thanks

I’ve seen something similar in VS Code before and using the Reload Window in VS Code seems to make it work again.