Need help with permissions

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
User avatar
DuFF
Forum Contributor
Posts: 495
Joined: Tue Jun 24, 2003 7:49 pm
Location: USA

Need help with permissions

Post by DuFF »

Hey guys, I'm helping NiceJob make a script and although it works fine on my server (Tripod/Lycos) it doesn't seem to like his server. Heres the code I'm using:

Code: Select all

<?php
else {
     touch($usersfile);
     chmod($usersfile,0666);
     $new_file=fopen($usersfile, "w");
     fwrite($new_file, "01|$username|");
     fclose($new_file);
     echo "Your username was successfully added.";
     }
?>
Works perfect for me but here are his errors:
Warning: touch() [function.touch]: Unable to create file usernames.dat because Permission denied in /home/jereese/public_html/RUC/nameadd.php on line 38

Warning: chmod() [function.chmod]: No such file or directory in /home/jereese/public_html/RUC/nameadd.php on line 39

Warning: fopen(usernames.dat) [function.fopen]: failed to create stream: Permission denied in /home/jereese/public_html/RUC/nameadd.php on line 40

Warning: fwrite(): supplied argument is not a valid stream resource in /home/jereese/public_html/RUC/nameadd.php on line 41

Warning: fclose(): supplied argument is not a valid stream resource in /home/jereese/public_html/RUC/nameadd.php on line 42

Obviously, all of the errors after touch have to do with the file not being created. Any help would be greatly appreciated.
Gen-ik
DevNet Resident
Posts: 1059
Joined: Mon Aug 12, 2002 7:08 pm
Location: London. UK.

Post by Gen-ik »

It could be that you need to make sure the RUC CHMOD value is set to 0777.
User avatar
DuFF
Forum Contributor
Posts: 495
Joined: Tue Jun 24, 2003 7:49 pm
Location: USA

Post by DuFF »

I've never used CHMOD before about an hour today. What's RUC mean?

[EDIT]
Well I'm stupid, u meant the RUC directory, sorry I wasn't payin attention to that cuz he put it in there, not me. He CHMOD'ed it and now it works. Thanks a lot.
[/EDIT]
Post Reply