Page 1 of 1

Help

Posted: Sat Jun 19, 2004 5:03 pm
by Noah
When I try to run my script on my website I get these errors.

Warning: fopen(count.txt): failed to open stream: Permission denied in /home/noah0504/public_html/index.php on line 39

Warning: fgets(): supplied argument is not a valid stream resource in /home/noah0504/public_html/index.php on line 40

Warning: fclose(): supplied argument is not a valid stream resource in /home/noah0504/public_html/index.php on line 46

When I run the script on my local machine, It runs just fine. What's the problem?

Here's my code.

Code: Select all

<?php
session_start();

$fp = fopen("count.txt", "r+");
$count = fgets($fp);
if ( !session_is_registered("counted") ) {
    fseek($fp, 0, SEEK_SET);
    fwrite($fp, ++$count);
    session_register("counted");
}
fclose($fp);
echo $count;
?>
[edit=Weirdan] Noah, use

Code: Select all

tags! [/edit] [/color]

Posted: Sat Jun 19, 2004 5:13 pm
by Weirdan
You have no permission to create the file or overwrite it. This is the problem.

Posted: Sat Jun 19, 2004 6:04 pm
by Noah
How do I set the permission?

Posted: Sat Jun 19, 2004 7:25 pm
by McGruff

Posted: Sat Jun 19, 2004 7:30 pm
by Noah
I've done all of that.

Posted: Sat Jun 19, 2004 8:39 pm
by Joe
Set the CHMOD of the file to something like 777. CuteFTP can set CHMOD's at the click of a button!

Posted: Sat Jun 19, 2004 8:44 pm
by feyd
...if the ftp server supports CHMOD, that is.

Posted: Sat Jun 19, 2004 8:45 pm
by tim
some ftp servers dont support that joe, so it may not be as easy as u made it out to be.

edit, man feyd thats twice u beat me in like, 3 mins. Drink some coffee and let me post, :lol: :lol: :lol: