Apache/PHP appears to be caching symbolic links for 60 seconds - how to stop it, or discover what is really caching the symlinks and stop that?
We have a PHP web application we are deploying to a LAMP server running CentOS 5.5 using Capistrano. Capistrano manages switching to the latest version (and rolling back) using a symlink, so our document root has to point to that symlink.
Unfortunately, we have been seeing that web requests to the PHP application still point to the previous target of the document root's symlink for exactly 60 seconds after the symlink is updated.
The only setting in the PHP config I could find that might relate to this is the realpath_cache_ttl
setting, however this is set to 120 seconds. I couldn't find anything in apache's configuration.
We are not using APC.
Am I even looking in the right place?
Symlinks are cached by Apache, I assume you are using FollowSymLinks in your httpd.conf. You could try using SymLinksIfOwnerMatch whose call to lstat is not cached http://httpd.apache.org/docs/2.0/misc/perf-tuning.html#symlinks
apache doesn't cache symlinks but it caches locations of files a bit and if you use APC it will really do some caching. I saw this also but used fabric for deploys. The work around was doing a apache restart/reload/graceful after the change symlink.
try a graceful first, then reload then restart if all else fails