note 61462 added to function.flock

From: Date: Sat, 04 Feb 2006 08:48:40 +0000
Subject: note 61462 added to function.flock
Groups: php.notes 
Request: Send a blank email to php-notes+get-102973@lists.php.net to get a copy of this message
damasta at onwebworx dot net said that it is impossible to delete a lock file inside of a register_shutdown_function callback. I found a way to do that. You just have to use an absolute path to the file: <?php function shutdown_callback() { unlink(dirname($_SERVER['SCRIPT_FILENAME']) . "/lock.lock"); //otherwise it wouldn't work echo "<h1>Terminating</h1>\n"; } ?> Funny that echo works too, although PHP Manual says it shouldn't work :) ---- Server IP: 84.18.202.180 Probable Submitter: 83.105.58.60 ---- Manual Page -- http://www.php.net/manual/en/function.flock.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+61462 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+61462&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+61462&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+61462&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+61462&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+61462&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+61462&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+61462&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+61462&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#102973) next »