; 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子進程)的存在,這個方法不是很適用。