I’m literally freaking out. I have a php file called Whatever.php in the “components” folder which contains a class definition for class Whatever which is an application component.
I have modified and saved the file. Now when I call the application from a browser, the old version is being executed. I am 100% positive about this. I can vim the php file on the server and see it’s my new version, but then I refresh teh page from the browser, I look at the application.log, and the newly logged traces are clearly from the old version. That is, the old version is being run NOW.
Does Yii have some sort of php class caching mechanism of its own that may have a bug? If not, does PHP itself?
What else could be causing PHP to “remember” an old version of a php file that has already been overwritten?
It MUST be some cache. If it’s of Yii, I haven’t enabled it unless it is by default.
But I guess it’s the server or PHP.
I’ve read about ACP, but I’m not sure I have ACP enabled on my php installation (or is it bundled with php by default??) The output of my phpinfo() doesn’t even contain the string “acp”.
Even deleting the file it runs as if the file was still there (the old version that doesn’t exist anyway)!!! It’s crazy. Whatever cache this is, it doesn’t work in any reasonable way (no decent cache system retains a cached copy of a file that has been modified). The strange thing is that this had never happened to me before and, needless to say, I had already been modifying-and-testing scripts all the time zillions of times, and I always, always observed the changes immediately. Why all of a sudden the cache got “frozen” and stopped updating is beyond me.
It looks like there are tons of PHP opcode caching systems, I just wonder how to figure out which one on earth I am using so that I can look fro how to manually flush/clear it.
As far as I know, Yii is not related to this problem. Yii doesn’t cache php file contents by itself.
PHP extensions like APC, XCache or MemCache may do it, but your phpinfo doesn’t report any of them. So I don’t think that php is to be blamed.
And if you haven’t changed any configuration of apache, I think it is irrelevant also.
So, the chances are, you have 2 Whatever.php: one in the componets directory and the other in somewhere else. I would search for the old Whatever.php in some corner of your directories. Sorry if I’m wrong.
Ok so it’s not Yii. No way I have 2 Whatever.php, nor even 2 Whatever classes. I have find’ed and grep’ed. I have only the new one in the whole filesystem.
So if I don’t have any cache-related extension, is there any documentation out there about PHP’s mysterious “own” or “native” or “internal” cache that surprisingly is not mentioned anywhere (I can find) in PHP’s documentation, where I could find how to manually flush it when it miserably fails to automatically update?
Another idea: Do you have any proxies in between or does your browser cache pretty aggressively? Perhaps it’s not backend related at all but its your browser cache or something in between (Perhaps try a hard-refresh?)
Yeah, and it points to a line that no longer exists.
It’s clearly some compiled opcode that is running, which is not from the new source. I just can’t figure out which damn cache system PHP is using and how to force a recompile (which should be done automatically whenever a source is modified, and used to be that way, but however…)
The phpinfo() doesn’t show any information about any kind of cache, and PHP documentation doesn’t say anything about a “default” or “native” opcode cache, other than APC which is not installed on my php… this is all so crazy
Don’t be ridiculous, that’s NOT the case. This is the same server I’ve been logging into for years, and there’s no other server where I have any copy of these files, so I couldn’t be possibly logging into another server believing it’s the same one.
It WAS a duplicate file mistake, at the end!!!!!!!! There was a copy of the old version of the file OUTSIDE the protected directory, in the webroot. Obviously copied by accident (don’t know how) in some uploading or rsyncing operation at some moment.
In all my double-checks, I always searched and grepped only the "protected" folder, not outside of it.
It’s damn strange, though, that Yii loads a php file that is outside the protected directory. I wouldn’t have ever expected it to…