I'm trying to write into a text file via PHP. My problem is that PHP always just clears the file instead of writing in it.
$fp = fopen('status.txt', 'w+');
fwrite($fp, "test");
fclose($fp);
I guess this depends on some permission issues. But I can't figure out what to change. At the moment the permission of the PHP file is:
-rwxrwx--- 1 www-data www-data 1980 Feb 18 11:25 test8.php
the permission of textfile is:
-rwxrwx--- 1 www-data www-data 0 Feb 18 11:25 status.txt
I'm using apache2 on my Raspberry Pi. The PHP script and the text file are stored in Apache main directory /var/www/