Warning stat failed for...
Posted by chris (chris), 8 March 2003Hi there,
i have a problem with a script that should evaluate the last access to some files with the function fileatime()
while ($file = readdir ($handle))
if ($file != "." && $file != "..")
Normally this piece of code should echo the unix timestamp for all the files in the directory 'online', but instead I get a warning:
Warning stat failed for filename (errno=2 - No such file or directory) in line .....
even though the files exist. In fact the have only just been created by another script.
Any Ideas why this is happening?
Posted by admin (Graham Ellis), 8 March 2003Hi, Chris ....
Four quick thoughts.
Firstly - are symbolic links involved? Is it possible that your script is looking at a link that points to a non-existant file?
Secondly - is the script that just created the files running as another user? If the directory "online" is your own directory and doesn't have enough permissions for the web server user, you maye get this sort of problem (you'll need both r and x on the directory in order to both see file names and their inode details)
Third - are you crossmounting file systems / working between two different systems (but I'm just having second thoughts about this idea ... not quite consistent with the evidence).
Fourth idea (and in review, my hot favourite - I think you need to add the directory name in front of $file in fileatime - as the code stands you're looking at a file in the CURRENT directory based on a name in the atime directory. LIne should read:
PH: 01225 708225 • FAX: 01225 793803 • EMAIL: email@example.com • WEB: http://www.wellho.net • SKYPE: wellho