Training, Open Source computer languages

This is page http://www.wellho.net/forum/Writing-PHP/Warning- ... d-for.html

Our email: info@wellho.net • Phone: 01144 1225 708225

 
For 2023 (and 2024 ...) - 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()

$handle=opendir('online');
while ($file = readdir ($handle))
     {
           if ($file != "." && $file != "..")
           {
             echo fileatime($file)."\t";
                 }
     }
closedir($handle);

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?

Greetz

Chris

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 www.opentalk.org.uk and archived here for reference. To jump to the archive index please follow this link.

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