note 61462 deleted from function.flock by danbrown

From: Date: Mon, 18 May 2009 00:39:43 +0000
Subject: note 61462 deleted from function.flock by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-155408@lists.php.net to get a copy of this message
Note Submitter: Ivan ---- 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 :)

« previous php.notes (#155408) next »