mr breaker
03-14-2004, 11:01 PM
I'm trying to open a text file for writing but am getting this error:
Warning: fopen(cgi-bin/counter.txt): failed to open stream: line 8
Warning: fputs(): supplied argument is not a valid stream resource line 9
Warning: fclose(): supplied argument is not a valid stream resource line 10
here is my code:
$counter_file = ("cgi-bin/counter.txt");
$visits = file($counter_file);
$visits[0]++;
line 8: $fp = fopen($counter_file , "w");
line 9: fputs($fp , "$visits[0]");
line 10: fclose($fp);
Is there something wrong with my code, or do I need different permissions to write to a file?
Warning: fopen(cgi-bin/counter.txt): failed to open stream: line 8
Warning: fputs(): supplied argument is not a valid stream resource line 9
Warning: fclose(): supplied argument is not a valid stream resource line 10
here is my code:
$counter_file = ("cgi-bin/counter.txt");
$visits = file($counter_file);
$visits[0]++;
line 8: $fp = fopen($counter_file , "w");
line 9: fputs($fp , "$visits[0]");
line 10: fclose($fp);
Is there something wrong with my code, or do I need different permissions to write to a file?