Hi, I've noticed a weird behavior when doing file access from PHP: PHP seems to make an lstat call on each of the parent directories of the accessed file, for example see this script:
<?php $fp=fopen("/var/www/metacafe/test","r"); fclose($fp); ?> When running with strace -e lstat I see this: lstat("/var", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 lstat("/var/www", {st_mode=S_IFDIR|0755, st_size=12288, ...}) = 0 lstat("/var/www/metacafe", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 lstat("/var/www/metacafe/test", 0x7fbfff9b10) = -1 ENOENT (No such file or directory) Measuring total syscalls time for an apache process on a production server, I found out that ~33% of the time it spends in syscalls is spent on lstat. I did a pretty deep web search on the issue and came out with nothing. I'll also note that I did a small experiment - moving our root portal folder to /, this gave an amazing performance improvement! So my questions are: What is the reason for doing these lstat calls? How can it be disabled? if not by configuration, maybe by patching php (can you direct me to where is this being done in php's source?) Thanks! -Amir.