为什么变量没有显示在PhpStorm的调试窗口中? [英] Why are variables not showing in the debug window in PhpStorm?

查看:378
本文介绍了为什么变量没有显示在PhpStorm的调试窗口中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有Xdebug可以工作,我可以停在断点处并逐步通过断点.但是它已经到达的变量不会显示在变量"窗口中.看到图片-变量$test$test2没有显示.

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.

我在php.ini中的配置是

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"

推荐答案

在过去的几天里,我一直把自己的头撞在桌子上.在CLI模式下运行程序(例如,在运行测试时)很好,但是尝试在浏览器中查看站点并使其达到断点时,我也没有看到任何本地初始化的变量.

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.

出现的问题是OpCache模块.这似乎在进行一些内部优化,并且var对Xdebug堆栈不可见.

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.

通过删除PHP模块配置中的符号链接来禁用OpCache模块,您将能够按预期看到本地变量.

Disable the OpCache module by removing the symlink in the PHP modules config and you're able to see the local vars as expected.

我已经在Docker容器中的Ubuntu映像上的最新PHP 7.2(FPM)上运行了它.

I have this running on the latest PHP 7.2 (FPM) on an Ubuntu image in a Docker container.

HTH =)

这篇关于为什么变量没有显示在PhpStorm的调试窗口中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆