; Determines the size of the realpath cache to be used by PHP. This value should ; be increased on systems where PHP opens many files to reflect the quantity of ; the file operations performed. ; http://php.net/realpath-cache-size ;realpath_cache_size = 16k ; Duration of time, in seconds for which to cache realpath information for a given ; file or directory. For systems with rarely changing files, consider increasing this ; value. ; http://php.net/realpath-cache-ttl ;realpath_cache_ttl = 120
lrwxr-xr-x 1 weizhifeng staff 10 10 22 16:41 app -> version0.1 drwxr-xr-x 3 weizhifeng staff 102 10 22 16:43 version0.1 drwxr-xr-x 3 weizhifeng staff 102 10 22 16:43 version0.2
[weizhifeng@Jeremys-Mac www]$ cat version0.1/hello.php <?php echo 'in version0.1'; ?>
[weizhifeng@Jeremys-Mac www]$ cat version0.2/hello.php <?php echo 'in version0.2'; ?>
location / { root /var/www/app; #app为symlink index index.php index.html index.htm; } location ~ \.php$ { root /var/www/app; #app为symlink fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fastcgi_params; }此时经过HTTP访问hello.php,获得的内容是’in version0.1′;修改/var/www/app,使其指向version0.2 [weizhifeng@Jeremys-Mac www]$ rm -f app && ln -s version0.2/ app 修改完成以后经过HTTP访问hello.php,获得的内容仍旧是”in version0.1″,可见是realpath cache在做祟了,此时你能够重启php-fpm或者等待120秒钟让realpath cache失效。 你能够使用clearstatcache来清 除realpath cache,可是这个只对当前调用clearstatcache函数的PHP进程有效,而其余的PHP进程仍是无效,因为PHP进程池(php-fpm生 成,或者Apache在prefork模式下产生的N个httpd子进程)的存在,这个方法不是很适用。