Search code examples
phpphp-5.2

PHP 5.2 Unexplainable - File stops executing properly


I have multiple virtual hosts running PHP 5.2.17. Periodically a script will seemingly randomly stop working properly. The script will silently fail and the browser will attempt to download the file. The only solution I've been able to find is ridiculous.

I have to go through all the files executed for the request in question. In each file I make an arbitrary change such as a blank line or extra space and save the file. I refresh after every save and eventually I find the file causing the issue and all is well again until the next occurrence.

My only hunch is that it has something to do with the function_exists function. It seems to be a common denominator in messed up files and that function is pretty uncommon. I can't seem to find anything to back up my guess and I can't find any evidence of it myself.


Solution

  • You have an issue with some sort of PHP optimizer/cacher/accelerators (Zend Optimizer, eAccelerator, APC, XCache, IonCube, etc.)

    That is the only time that changing the file by that small amount would make a difference.

    Normally every time you access a PHP file it is converted into bytecode and then processed by PHP.

    An accelerator (among other things) saves the bytecode the first time you access the file to speed things up, and would only refresh the bytecode cache if it thinks the file has changed.