Dynamic PHP requires/includes, APC and Habari

This topic has been talked about across teh interwebs quite a bit already, but I’m putting it here for potential googlers to come across it when looking for Habari related posts.

Like a lot of blogging/CMS software, Habari uses PHP dynamic includes and requires for pulling in user-selected themes and plug-ins. This might cause some problems for you if you use the opcode caching extension APC (or one of the other alternatives like Xcache) to speed up PHP apps on your server (by caching the compiled opcode data, so the Zend engine doesn’t have to compile this everytime the script is executed).
Normally opcode caches check to see if the file has been modified, but because dynamic includes/requires use runtime variables to define where a file is pulled from, the caches can become a bit screwed up if you move any files around.

2 ways to solve this are to 1) flush the cache (you can find more about this in your opcode caches documentation, I for one used the default apc.php admin script that comes with APC to log in and flush the data), or 2) update the mtime on the file that’s throwing a fatal error to tell the cache to update for this file.