note 14886 deleted from function.fopen by alindeman

From: Date: Sat, 17 May 2003 20:58:28 +0000
Subject: note 14886 deleted from function.fopen by alindeman
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-48253@lists.php.net to get a copy of this message
Note Submitter: mcrosland@chello.nl If you need to replace the contents of a file, but are getting problems with ownership/permissions, ftruncate can be used to effectively delete the contents by truncating the size of the file to 0 thus; ftruncate($file,0); fwrite($file,$my_stuff); Using this method will allow you to replace the file contents without changing ownership. The alternative method of using unlink() to delete the file then replacing it with a new file is unsatisfactory because the file created will be owned by 'nobody'.

« previous php.notes (#48253) next »