Training, Open Source computer languages
PerlPHPPythonMySQLApache / TomcatTclRubyJavaC and C++LinuxCSS 
Search for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
For 2023 - we are now fully retired from IT training.
We have made many, many friends over 25 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Linux and Solaris/SunOS too. Our training notes are now very much out of date, but due to upward compatability most of our examples remain operational and even relevant ad you are welcome to make us if them "as seen" and at your own risk.

Lisa and I (Graham) now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We are far from inactive - rather, enjoying the times that we are retired but still healthy enough in mind and body to be active!

I am also active in many other area and still look after a lot of web sites - you can find an index ((here))
Warning stat failed for...

Posted by chris (chris), 8 March 2003
Hi 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 != "..")
             echo fileatime($file)."\t";

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 2003
Hi, 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:
         echo fileatime("online/$file")."\t";

This page is a thread posted to the opentalk forum at and archived here for reference. To jump to the archive index please follow this link.

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2023: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: • WEB: • SKYPE: wellho