My write-to file keeps emptying after 2 kb
<p>I am trying to save tokens to a php file using this code, but after 2kb the file mysteriously empties and I lose all the data. Why does this happen? how do I prevent it?</p>

<pre><code>   $fh = fopen('token.txt', 'a+');
    fwrite($fh, $access_token . "\n");
    fclose($fh);
</code></pre>
