php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #23950 flock seems to not work
Submitted: 2003-06-02 05:22 UTC Modified: 2003-06-02 05:25 UTC
From: bibifoc23 at yahoo dot fr Assigned:
Status: Not a bug Package: Filesystem function related
PHP Version: 4.3.2 OS: Linux
Private report: No CVE-ID: None
 [2003-06-02 05:22 UTC] 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.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-06-02 05:25 UTC] derick@php.net
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
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 03 22:01:33 2024 UTC