What is the problem of this code in PHP?
<?php
$f = "log.txt";
$fh = fopen($f, 'a') or die("Can't open log file");
$s = "Test Line\n";
fwrite($f, $s);
fclose($f);
?>
The permission of the log.txt is 777.
But fwrite
can't write anything in it.
What is the problem?
Try this...
<?php
$f = "log.txt";
$fh = fopen($f, 'a') or die("Can't open log file");
$s = "Test Line\n";
fwrite($fh, $s);
fclose($fh);
?>
Actually you are using file name instead of file handle.