Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

chmod folder in php?

Status
Not open for further replies.

mkzw0ot4m0nk

Programmer
Jul 19, 2002
29
0
0
US
im creating a profile service and im working on the register page.. i already have a folder called users made and i have it chmod 777 so i can make another folder in it which does work. but when i go to write inside the folder i just created with php it wont create it. i get this error..

Warning: fopen("public_html/profileservice/users/mkzw0ot4m0nk/pass.php", "w") - No such file or directory in /home/mkzmonkeylagger/public_html/profileservice/new.php on line 17

Warning: fwrite(): supplied argument is not a valid File-Handle resource in /home/mkzmonkeylagger/public_html/profileservice/new.php on line 18

Warning: fclose(): supplied argument is not a valid File-Handle resource in /home/mkzmonkeylagger/public_html/profileservice/new.php on line 19

heres some of the code..

$dir = "users/$sn";
mkdir("$dir", 0755);
$fp = fopen("public_html/profileservice/users/$sn/pass.php", "w");
fwrite($fp,"$mypass = $pass");
fclose($fp);


any ideas?
 
change this :
$fp = fopen("public_html/profileservice/users/$sn/pass.php", "w");

to
$fp = fopen("users/$sn/pass.php", "w");
______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
if i do that i get this error..

Warning: SAFE MODE Restriction in effect. The script whose uid is 2016 is not allowed to access / owned by uid 0 in /home/mkzmonkeylagger/public_html/profileservice/new1.php on line 13

Warning: fopen("/users/monkey/pass.php", "w") - No such file or directory in /home/mkzmonkeylagger/public_html/profileservice/new1.php on line 13

Warning: fwrite(): supplied argument is not a valid File-Handle resource in /home/mkzmonkeylagger/public_html/profileservice/new1.php on line 14

Warning: fclose(): supplied argument is not a valid File-Handle resource in /home/mkzmonkeylagger/public_html/profileservice/new1.php on line 15
 
Remove the first / from the path, so that the path is "users/monkey/pass.php" //Daniel
 
$dir = "users/$sn";
mkdir($dir,0777);
$fp = fopen("users/$sn/pass.php", "w");
fwrite($fp,"$mypass = $pass");
fclose($fp);




Warning: SAFE MODE Restriction in effect. The script whose uid is 2016 is not allowed to access /home/mkzmonkeylagger/public_html/profileservice/users/roflmao owned by uid 33 in /home/mkzmonkeylagger/public_html/profileservice/new1.php on line 13

Warning: fopen("users/roflmao/pass.php", "w") - No such file or directory in /home/mkzmonkeylagger/public_html/profileservice/new1.php on line 13

Warning: fwrite(): supplied argument is not a valid File-Handle resource in /home/mkzmonkeylagger/public_html/profileservice/new1.php on line 14

Warning: fclose(): supplied argument is not a valid File-Handle resource in /home/mkzmonkeylagger/public_html/profileservice/new1.php on line 15
 
Doh! just read your mkdir command, it should be mkdir($dir, 0777); // heres where you set rwx permissions 755 is rwxr-xr-x , no write permission for the fopen() command. ______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
ignore the last one, 90% alseep :)

$dir = "users/$sn";
chmod("users",0777); // make sure we can write into the user dir.
mkdir($dir,0777);
$fp = fopen("users/$sn/pass.php", "w");
fwrite($fp,"$mypass = $pass");
fclose($fp);
______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
i think my free host is the problem. im going to get another host. 10 bucks a month. ill keep you guys updated if the script still works. Karver my AIM SCREENNAME IS OwningMonkey
 
Aim Screenname ...? beered up and puzzled now.... ______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top