13

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.

enter image description here

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"
4
  • Please show whole debug window and not only part of it.
    – LazyOne
    May 30, 2018 at 19:18
  • @LazyOne I have updated the pic. May 30, 2018 at 19:36
  • Well ... $test2 is kind of understandable (not used anywhere) .. but $test should have been listed. Can you reproduce the same in some simple code? Does it behave the same in another project? IDE and Xdebug versions? What Xdebug log has to say? If it's not listed there then no wonder that IDE does not show it. Maybe show whole xdebug section of phpinfo() output -- maybe some option may help. can you evaluate $test current value? How you installed current IDE version -- was it a full installer or built-in update? Try removing IDE and installing again using full installer..
    – LazyOne
    May 30, 2018 at 19:46
  • @LazyOne thanks very much, I'll go through these suggestions and report back. May 30, 2018 at 19:51

3 Answers 3

15

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 =)

6
  • 1
    THAT WAS IT!!!! Very nice. Don't load opcache. I'm running docker image php:7.2-apache with xdebug 2.6.1 and removing opcache WORKED!!! You are the man. Feb 14, 2019 at 19:34
  • 1
    Trial and error initially, then found some info about internal optimisations (can't remember where now) that confirmed that opcache was the culprit :)
    – Ian.H
    Mar 27, 2019 at 21:10
  • 1
    I can confirm that too, opcache was an issue
    – David
    Jun 21, 2019 at 7:51
  • 1
    I can confirm disabling OpCache fixes the issue, as well. Thank you very much. Jul 7, 2019 at 21:01
  • 1
    Ran into this using Local by Flywheel with custom environment (which is required for xdebug anyway) and PHP Debugger in vscode. Commented out the line zend_extension = /opt/php/7.3.2/lib/php/extensions/no-debug-non-zts-20180731/opcache.so in my site's php.ini and restarted the site. This issue was hard to track down due to everything being involved with the stack. Thank you so much!! Sep 5, 2019 at 18:23
1

I had similar problem. It happened that php version was 7.2 but extensions were installed for 7.1 version by Dockerfile.

0

I have the same problem I fixed by disabled opcache in my php.ini file

opcache.enable=0

After reload your server

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.