Could you help me with a bit of a puzzle? Imagine a deploy system which used a symlink to atomically replace the docroot. In addition to that, say this deploy system just renamed an old directory, then rsynced on top of it in order to save rsync bandwidth and also to reuse inodes such that unchanged files would not need to be recompiled across multiple rapid deploys. Sounds reasonable so far?
There is a bit of an oddity in APC which prevents this strategy from working and it is one I didn't foresee going in. When we compile and cache a file we store the original realpath with the op_array in the cache. Then when the script does an include of that file and we pull it from the cache and we populate the included_files list with the realpath from the cache. What is interesting here is that this realpath doesn't necessarily reflect the current realpath for this inode, so if you have code like this: include 'a.php'; include_once 'a.php'; and a.php was cached from a previous docroot, then it is going to be included twice because we realpath first on the include_once and check the current realpath against the paths in the included_files list. This is rather annoying. An obvious fix would be to stop comparing realpaths, or at least augment it and also compare inodes. But that requires PHP-level likely binary-compatibility breaking changes and it isn't a problem in PHP unless it is running with APC. An APC-level fix might be to fix the include_once/require_once override implementation to go to the cache first to see if the inode is there and pull out the cached realpath and use that to check against the included_files list. The downside is that we will likely end up with 2 cache lookups on every include_once. Any other ideas? -Rasmus -- PECL development discussion Mailing List (http://pecl.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
