note 55664 added to function.flock

From: Date: Wed, 10 Aug 2005 03:28:27 +0000
Subject: note 55664 added to function.flock
Groups: php.notes 
Request: Send a blank email to php-notes+get-93347@lists.php.net to get a copy of this message
just wanted to say that you will most likely fail if you use a separate lock file together with register_shutdown_function. my script did some different actions... resizing pictures, rotating them and this stuff. it needed a "database" file to get the correct file locations. this database file also stored some flags. and of course the script had to save that file when it was done. because of my script exited on many different points depending on the action i used register_shutdown_function to save the file. it wanted to use a locking system to be sure the script doesn't overwrite the data another process had written into it some microseconds before. i was running on windows 2000 and apache2 on my developing machine, and flock always returned true for some reason... so i used a separate lock file. the script looked for it at the beginning and exited if it was found. otherwise it created it. but this file had to be deleted at the end. i put the unlink command into the registered shutdown-function but it never deleted the file. i tried clearstatcache and some other stuff but it didn't help. maybe this helps someone. ---- Manual Page -- http://www.php.net/manual/en/function.flock.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+55664 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+55664&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+55664&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+55664&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+55664&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+55664&report=yes&reason=non-english Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+55664&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+55664&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#93347) next »