php - fwrite() function erase .txt file but do not write in it -
i'm stuck problem fwrite() in php. i'm using raspberry pi running server on apache2. code works on windows. problem cannot write file. code erase in file , didn't write it. can see file updated, still 0 bytes written. permissions file, folder , user set should be. logging root account , executing php code make sense. googled 3 days , has same problem me, mentioning selinux. appreciated.
this php code:
<?php error_reporting(e_all); ini_set('display_errors', '1'); if (isset($_post['temp'])) { $name = $_post['temp']; $fp = fopen("/var/www/smarthome/webcompare6.txt", "a"); $data = "$name"; echo ("$name"); fwrite ($fp, ($data)); sleep (1); fclose ($fp); } ?>
this html form, write user input .txt file:
<form name="form" method="post" action="room6.php"> temperature: <input type="text" name="temp"> <input type="submit" name="set" value="set"> </form></th>
Comments
Post a Comment