Page 1 of 1

file command errors

Posted: Thu Mar 25, 2010 6:28 am
by kandarpmistry
PHP CODE:

<?php
error_reporting(E_ALL ^E_NOTICE);
$count_my_page = ("hitcounter.txt");
$hits = file($count_my_page);
$hits[0] ++;
$fp = fopen($count_my_page , "w");
fputs($fp , "$hits[0]");
fclose($fp);
echo $hits[0];
?>

ERRORS:

Warning: fopen(hitcounter.txt) [function.fopen]: failed to open stream: Permission denied in

counter.php on line 6

Warning: fputs() expects parameter 1 to be resource, boolean given in counter.php on line 7

Warning: fclose() expects parameter 1 to be resource, boolean given in counter.php on line 8

Please help rectify this problem, thank you