Search code examples
phpfilefwrite

In PHP, why won't this write to test.txt?


My code is

<?php
$fp = fopen('test.txt', "a+");
fwrite($fp, 'Cats chase mice');
fclose($fp);
?>

but test.txt is still empty. I don't see anything wrong and I don't understand why it's not writing.


Solution

  • Write this in a console

    chmod a+w test.txt