> I have this script whereby I use the php function file(). > Just a quick question, do I need to implement file locking.
If you want to ensure that the file is not changed by other scripts while you're reading from it, yes. Note that this is advisory only - writer scripts will only respect the lock if they request a write lock. See manual for details. > if so, can I just use something like > flock( file("/path/file.ext") ); flock() takes a file handle as an argument, not an array of strings: $fh = fopen("/path/file.ext", 'r'); flock($fh, LOCK_SH); // read from file here flock($fh, LOCK_UN); fclose($fh); See example 1 in the manual page for flock for more info. --------------------------------------------------------------------- michal migurski- contact info and pgp key: sf/ca http://mike.teczno.com/contact.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php