CHMOD - HELP

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
torevaal
Forum Newbie
Posts: 2
Joined: Tue Feb 11, 2003 1:59 am

CHMOD - HELP

Post 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
crazyjimsmith
Forum Commoner
Posts: 28
Joined: Sat Jan 11, 2003 1:46 pm
Location: Sydney
Contact:

Post 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.
torevaal
Forum Newbie
Posts: 2
Joined: Tue Feb 11, 2003 1:59 am

Post by torevaal »

It works thanks Jim...(I was kinda hoping there would be more to it than that.)

-Tore
Post Reply