file command errors

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
kandarpmistry
Forum Newbie
Posts: 8
Joined: Sat Feb 13, 2010 11:28 pm

file command errors

Post 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
Post Reply