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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: bibifoc23 at yahoo dot fr
New email:
PHP Version: OS:

 

 [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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 03 11:01:34 2025 UTC