Plugin php file changes not taking effect


Well-known member
I created a basic plugin from one of the tutorials, to just look for an advert hook and then display a random banner.

This has been working fine for months but now I have an odd problem - I cannot make any changes to it!

The plugin looks for a specific hook then includes advert.php.

advert.php is a file that generates a random number and then includes another random file, such as banner1.php, banner2.php, banner3.php and so on.

No matter what changes I make to advert.php, they won't show, it keeps running as if the old version is there. No matter what changes I make to banner1.php (etc) they won't show either. I can even delete these files from the server, and the banners still run! How is this possible?

Yet if I change the plugin to include say advertnew.php instead of advert.php, then upload advertnew.php, the new file does indeed work. So the plugin file itself can be changed. Just every one of the existing included files, cannot.

I have ruled out my FTP because if I use a different PC and download the advert.php file, the changes I made are all there and correct. They just seem to be ignored by the server.

Why? Is there some sort of caching going on here? There is no caching defined in my config (I am on shared hosting anyway).

Anyone have any clues please?

In case anyone asks why don't I just rename the file as this works, the problem is I have around 30 advert files which all need changing, so that's a lot to rename and redo, I just want to edit the .php files and for these changes to work, as they should!


Well-known member
That sounds complicated. A file that includes another file that generates a random number then includes yet another file?! That could do with some simplifying to begin with.

It's strange for it to randomly not work, can you think of any changes you made around that time? Maybe another admin disabled the add-on?


Well-known member
The plugin works fine, as I said above changes to the plugin code take effect, changes to the included php files don't.

If I amend the plugin code to include a brand new file, it works, I can then edit that file, and the changes show each time I upload the new version of that file.

Also if I include a brand new file, then delete it, the forum crashes (as it can't find that file), but if I delete one of the original included files, it still works, as if it's not deleted. Scary!

And any changes to the original included files, don't show up.

It's almost as if the forum or the server has said "These files haven't changed for ages, let's cache them".

And yes it's a terrible way of including random banners and I shall probably have to rewrite it to include all the code within the plugin, as obviously something's not working on my set-up with included files.

But I would like to try and get to the bottom of it.

Jake Bunce

XenForo moderator
Staff member
Do you have an opcode cache on the server like APC or Zend Optimizer? The cache might be failing to update. A server restart will usually fix that.


Well-known member
The host has said "No we do not offer any caching tools on the cloud as the ones mentioned". They are basically saying it's not them.

If I can delete an included php file and there it is, still running, something somewhere must be caching it you would think?


Well-known member
Some developments to this Jake.

My host has acknowledged that I have correctly changed the included php files and have no idea why they don't work, they say they have no caching in operation and this must be a Xenforo related issue.

I've had to work around this as I need to make some changes to advert banners and this will be fluid for a few weeks, I can't afford to have any changes cached again. With that in mind, I have learned some PHP code and redone the plugin, so it no longer includes files, but generates the random banner within the plugin.

So I have fixed it this way, but would still be grateful if anyone can shed any light as to why a file included in a plugin in this manner appears to have been cached and cannot be changed:

$contents .= ob_get_contents();