> I understood you correctly using temp file and then rename should fix > that? Like this? > >> file_put_contents('test.tpl.tmp', "<?php #".str_repeat('A', > mt_rand(4000, 5000))." ?>\n", LOCK_EX); > rename('test.tpl.tmp','test.tpl');
Exactly! You could also do it like this: $tmpname = 'test.tpl.tmp.'.posix_getpid(); file_put_contents($tmpname, '....'); rename($tmpname, 'test.tpl'); That way - adding the process ID to the temporary filename - does not run into the danger of two processes changing the file at the same time. The LOCK_EX should handle that case, too, but I usually go for the "appended PID" approach and don't worry about file locking at all. best regards Patrick -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php