4

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.

4 Answers 4

6

Answering my own question...

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.

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

Before finding the answer, I tried...

  • turning off nginx cache
  • setting nginx conf to sendfile off;
  • setting nginx conf to expires off;

... 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

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

1 Comment

FYI another way to fix this, but leave OPcache on is to change opcache.revalidate_freq to 0 instead. OPcache.revalidate_freq=0
1

My problem regarding this issue was solved by referring to this link

:Nginx Server “caches” PHP. Updated Page does not Reload

by :

service php-fpm restart # most centos
service php7-php-fpm restart # centos and remi php7
service php7.0-fpm restart # ubuntu

Comments

-1

did you try the below meta tag in your header?

<meta http-equiv="Cache-control" content="no-cache">

Comments

-3

Try hitting ctrl+shift+R for hard reload. Your welcome.

2 Comments

Arrogant and wrong, what a combination.
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.

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.