file permissions or something like that...

From: Date: Fri, 05 Jan 2001 16:57:52 +0000
Subject: file permissions or something like that...
Groups: php.general 
Request: Send a blank email to php-general+get-32901@lists.php.net to get a copy of this message
Hello all. I have struggled with this problem for at least a week and no one seems to know how to fix it. Basically, I have a script that creates a directory when a new user signs on. The code is below: umask(011); mkdir("/path/to/dir/for/$newuser", 0777); Without the umask above the statement, the perms that were set were 755, even with the 777 explicitly stated (I know 777 is bad, but I'm going to make it 755 when it all works correctly), which confused me a lot, but as long as it works... So the directory is created fine with perms of 777. Then I want to create some files, and update them as a database gets changed. The code for creating (and editing) the file is: if ($file = fopen ("path/to/dir/for/$newuser/index.htm", "w")){ if (!(fwrite ($file, $htmldoc))){ echo "unable to write to index file<br>"; }//end if fclose($file); }//end if Each time this is run, I get the following error... fopen("path/to/dir/for/jason/Menu.htm","w+") - No such file or directory 1)Isn't fopen() supposed to create the file if it doesn't already exist, and 2)if it's a permission error, why? The same user (http on our server) that creates the directory is writing the file, so it should have the ability to write the file, especially since the perms are 777 on the dir. 3)When I log into the site on my FTP program as the admin user for the site, I can delete these folders that are created by PHP, but I can't open them to see what's in them. That's confusing me too. BTW, I started using PHP a couple months ago, and all I did was jump in, so I may be missing some pretty small things. Thanks for the help. Jason

« previous php.general (#32901) next »