Here is an example how to open and append to a text file:
$file = 'log.txt'; $current = file_get_contents($file); $current.="This is my log message"; file_put_contents($file, $current);