php不能始终显示对文件的更改 [英] php not showing changes to files consistently

查看:116
本文介绍了php不能始终显示对文件的更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在更改php文件,但有时没有显示.有时它们会立即显示.有时我不得不等待几分钟.我已经检查并关闭了所有可以关闭的缓存.问题是不一致的,很难一贯地重复.

I am making changes to php files and they are not showing -- sometimes. Sometimes they will show immediately. Sometimes I have to wait a few minutes. I've gone through and turned off all the cache that I could think to turn off. The problem is inconsistent and tough to duplicate consistently.

推荐答案

回答我自己的问题...

Answering my own question...

我花了很长时间进行试验以一致地重现该行为.我不得不让服务器坐了几分钟,而没有刷新任何页面.然后,如果在刷新页面之前更改文件,则更改将立即显示,而所有后续更改将立即显示.如果我先刷新页面,然后对文件进行更改,则直到我刷新10到20次左右,才显示后续更改.

I spent quite awhile doing trials to consistently reproduce the behavior. I had to let the server sit without refresh any page for a few minutes. Then if I change the file before I refresh the page, the change show immediately and all subsequent changes show immediately. If I refresh the page first, then make a change to the file, then no subsequent changes show until I refresh 10-20 times, or so.

顺便说一句,html文件显示所有更新,无论如何,因此这是一个php问题.

BTW, html files show all updates regardless, so it was a php issue.

在找到答案之前,我尝试过...

Before finding the answer, I tried...

  • 关闭nginx缓存
  • 将nginx conf设置为sendfile off;
  • 将nginx conf设置为expires off;
  • turning off nginx cache
  • setting nginx conf to sendfile off;
  • setting nginx conf to expires off;

...这些都不起作用.然后,我发现它实际上是OPcache.我通过将php.ini文件更改为此(并重新启动所有服务)来解决了该问题

... none of these work. I then found that it was in fact OPcache. I fixed the issue by changing the php.ini file to this (and restarting all services)

opcache.enable=0

这篇关于php不能始终显示对文件的更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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