Actually I am trying to fail the file_put_contents() for learning purposes. If the file is locked by another process ,file_put_contents() will return false. I have locked file using flock() so it shouldn't be accessible by file_put_contents() until I call fclose() or script ends.