I'll try to be both concise and precise with this.

I have some PHP code like this:

 if (!rename($path_to_file,$path_to_file_BACKUP))
die("$unable_to_access_file_msg $path_to_file_BACKUP");
 $buffersize = round(filesize($path_to_file_BACKUP)*1.5);
 $fp_in = fopen("$path_to_file_BACKUP","r") or
die("$unable_to_access_file_msg $path_to_file_BACKUP");
 $fp = fopen("$path_to_file",'a') or die("$unable_to_access_file_msg
$path_to_file");
 set_file_buffer($fp,$buffersize);
 fwrite($fp,"hello") or die("HELP!");
 fclose($fp);

This works, sort of.  It dies with HELP!  The rename happens exactly as
required.  However, when PHP creates the $fp file, the owner and permissions
are different.  I can chmod the permissions, through PHP
(chmod($path_to_file,0777) , but I can't seem to change the owner, using
chown (it says it is not allowed).  The original file, before being renamed
and the directory are 0777.  After the rename, the old file is still 0777,
but the new file ($fp) is 0644.  It appears that the new owner is the root
directory for the server document (in this case 1792=www), instead of the
group.  As an example, before the rename, the owner is 1444 as is the group.
When $fp is created, the owner is now 1792 but the group is still 1444 (user
name of the ftp account).

On most systems, this seems to work ok. But on some linux systems, it fails
due to the ownership.  The PHP program cannot write to the new file.  I'm
hoping that I'm overlooking some minor/major factor here, that someone
will/can point out.  How does PHP, or is it the server, get ownership?

I hope this make sense.

Thanks!

--
Gaylen
[EMAIL PROTECTED]
Home http://www.gaylenandmargie.com/
PHP KISGB v2.6 Guest Book http://www.gaylenandmargie.com/phpwebsite/





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to