I have Xdebug working, I can stop at and step through breakpoints. But the variables that it has already reached do not show up in the Variables window. See the picture - variables $test
and $test2
do not show up.
My config in php.ini is
[XDebug]
zend_extension = /usr/lib/php/20170718/xdebug.so
xdebug.remote_host = 127.0.0.1
xdebug.remote_port = 10000
xdebug.remote_mode = req
xdebug.remote_enable = 1
xdebug.remote_autostart = 1
xdebug.idekey = "PHPSTORM"
You can click on the Run icon in the gutter area and select the Debug option. You can invoke context actions on the class or main method by using Alt+Enter and choose the Debug action. You can also start it from the Run menu, or by pressing Shift F9.
Select a variable or a property of a complex object in the Debug window, press F2 or right-click and choose Set Value... from the context menu, and then specify a new value and press Enter .
You can click in the editable line under the name column and type in the variable name whose value you want to see. Or you can right click on variables from your code editor and select “Add to Watch”. Beyond adding just a single variable, you can type in generally any expression.
I've been banging my head against my desk with the very issue myself for the past few days. Running things in CLI mode (when running tests for example) was fine, but trying to view a site in the browser and getting it to hit a breakpoint, I wasn't seeing any locally initialised variables either.
The issue it appears is the OpCache module. This seems to do some internal optimisations and the vars become non-visible to the Xdebug stack.
Disable the OpCache module by removing the symlink in the PHP modules config and you're able to see the local vars as expected.
I have this running on the latest PHP 7.2 (FPM) on an Ubuntu image in a Docker container.
HTH =)
I had similar problem. It happened that php version was 7.2 but extensions were installed for 7.1 version by Dockerfile.
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