Page 1 of 1

CHMOD - HELP

Posted: Tue Feb 11, 2003 1:59 am
by torevaal
I'm a newbie to php. I just wrote me first hit counter script. The script works fine on my computer (win2000), but when I upload it to my webserver (linux) I get the permission denied error.
----
(Warning: fopen("./count.dat", "w") - Permission denied in /usr/local/psa/home/vhosts/vaalanddesign.com/httpdocs/hit_counter1.php on line 13)
----
Here is the full code:

//hit_counter1.php
$counter_file = "./count.dat";
if(!($fp = fopen($counter_file, "r"))) die ("Cannot open $counter_file.");
$counter = (int) fread($fp, 20);
fclose($fp);

$counter++;

echo "You're visitor No. $counter.";

$fp = fopen($counter_file, "w");
fwrite($fp, $counter);
fclose($fp);

How do I apply the CHMOD code???

Thanks

Posted: Tue Feb 11, 2003 2:06 am
by crazyjimsmith
with your ftp client select the file you want to change. Right click it and you should get a chmod item in the list displayed. I use wsftp and thats what I get.

When you click on it you will get something like this

owner group other

read read read

write write write

execute execute execute


In the other section pick read and write and i think you will also need to pick execute as well. Some ftp clients use numbers and the numbers to allow everything is 777. Try and put your text file outside the root folder for increase security.

Posted: Tue Feb 11, 2003 2:56 am
by torevaal
It works thanks Jim...(I was kinda hoping there would be more to it than that.)

-Tore