Nicolas, You could try something like
<? $pifFile = "/path/to/file/filename"; if(file_exists($pifFile)) { $fp = fopen($pifFile, "r"); flock($fp, 2); // your code fclose($fp); } Note: Just wrote it, not tested. Note: You would probably want to do somethig more graceful then simply rely on the file existing... like create the file if it doesn't exist and then lock it. Note: From the manual - flock() will not work on NFS and many other networked file systems. Check your operating system documentation for more details. On some operating systems flock() is implemented at the process level. When using a multithreaded server API like ISAPI you may not be able to rely on flock() to protect files against other PHP scripts running in parallel threads of the same server instance! >Anybody has an example of how to use flock ?