note 84928 added to function.unlink

From: Date: Wed, 06 Aug 2008 12:07:11 +0000
Subject: note 84928 added to function.unlink
Groups: php.notes 
Request: Send a blank email to php-notes+get-143207@lists.php.net to get a copy of this message
I have been working on some little tryout where a backup file was created before modifying the main textfile. Then when an error is thrown, the main file will be deleted (unlinked) and the backup file is returned instead. Though, I have been breaking my head for about an hour on why I couldn't get my persmissions right to unlink the main file. Finally I knew what was wrong: because I was working on the file and hadn't yet closed the file, it was still in use and ofcourse couldn't be deleted :) So I thought of mentoining this here, to avoid others of making the same mistake: <?php // First close the file fclose($fp); // Then unlink :) unlink($somefile); ?> ---- Server IP: 213.249.64.162 Probable Submitter: 83.87.4.41 ---- Manual Page -- http://www.php.net/manual/en/function.unlink.php Edit -- https://master.php.net/note/edit/84928 Del: integrated -- https://master.php.net/note/delete/84928/integrated Del: useless -- https://master.php.net/note/delete/84928/useless Del: bad code -- https://master.php.net/note/delete/84928/bad+code Del: spam -- https://master.php.net/note/delete/84928/spam Del: non-english -- https://master.php.net/note/delete/84928/non-english Del: in docs -- https://master.php.net/note/delete/84928/in+docs Del: other reasons-- https://master.php.net/note/delete/84928 Reject -- https://master.php.net/note/reject/84928 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#143207) next »