#23950 [Opn->Bgs]: flock seems to not work

From: Date: Mon, 02 Jun 2003 10:25:36 +0000
Subject: #23950 [Opn->Bgs]: flock seems to not work
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-40890@lists.php.net to get a copy of this message
ID: 23950 Updated by: derick@php.net Reported By: bibifoc23 at yahoo dot fr -Status: Open +Status: Bogus Bug Type: Filesystem function related Operating System: Linux PHP Version: 4.3.2 New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php From the manual (http://nl3.php.net/flock): PHP supports a portable way of locking complete files in an advisory way (which means all accessing programs have to use the same way of locking or it will not work). Not a bug -> bogus Previous Comments: ------------------------------------------------------------------------ [2003-06-02 05:22:46] bibifoc23 at yahoo dot fr hello, Chen i use flocks on Linux, it is always possible to write or read the locked file. Script: <?php $fp = fopen ( 'lock.tmp', 'a+'); if( flock ( $fp, LOCK_EX ) ) { fwrite ( STDOUT, "Lock good...\n"); } else { fwrite ( STDOUT, "Error getting Lock...\n"); } sleep ( 30 ); if( flock ( $fp, LOCK_UN ) ) { fwrite ( STDOUT, "Lock release good...\n"); } else { fwrite ( STDOUT, "Error released Lock...\n"); } ?> during sleep, i run "echo test >> lock.tmp" under shell. And it is works fine. On windows 2000, it is seems to works. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=23950&edit=1

« previous php.bugs (#40890) next »