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

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -