14

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. Commented May 30, 2018 at 19:18
  • @LazyOne I have updated the pic. Commented 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.. Commented May 30, 2018 at 19:46
  • @LazyOne thanks very much, I'll go through these suggestions and report back. Commented 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 =)

Sign up to request clarification or add additional context in comments.

6 Comments

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.
Trial and error initially, then found some info about internal optimisations (can't remember where now) that confirmed that opcache was the culprit :)
I can confirm that too, opcache was an issue
I can confirm disabling OpCache fixes the issue, as well. Thank you very much.
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!!
|
1

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

Comments

-1

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

opcache.enable=0

After reload your server

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.