[PHP] flock and file reading

2008-08-05 Thread ragnarok
Hi all, I've simple question: LOCK_EX is only effective for file writing or it locks reading, too?   Ciao, Stefano -- Email.it, the professional e-mail, gratis per te: http://www.email.it/f Sponsor: E' arrivato EmailBlog, il blog ufficiale di Email.it. Partecipa anche tu! Clicca qui: http

RE: [PHP] flock(), fclose() and O/S buffering

2004-07-01 Thread Michael Sims
Andrew Hill wrote: > $fp = fopen("/tmp/lock.txt", "w+"); > if (flock($fp, LOCK_EX)) { // do an exclusive lock >fwrite($fp, "$processName\n"); >flock($fp, LOCK_UN); // release the lock > } else { >echo "Couldn't lock the file !"; > } > fclose($fp); [...] > In this case, although process

[PHP] flock(), fclose() and O/S buffering

2004-07-01 Thread Andrew Hill
Hi all, I have a question about the way flock() and fclose() work in PHP. Consider the following code, slightly modified from the flock() PHP manual page: $fp = fopen("/tmp/lock.txt", "w+"); if (flock($fp, LOCK_EX)) { // do an exclusive lock fwrite($fp, "$processName\n"); flock($fp, LOCK_U

Re: [PHP] flock problem

2004-02-28 Thread Armand Turpel
. !?! Why?? - Original Message - From: "Rasmus Lerdorf" <[EMAIL PROTECTED]> To: "Armand Turpel" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Saturday, February 28, 2004 8:04 PM Subject: Re: [PHP] flock problem > Is the file on an N

Re: [PHP] flock problem

2004-02-28 Thread Rasmus Lerdorf
Is the file on an NFS-mounted filesystem? flock() in 4.3.3 works fine. -Rasmus On Sat, 28 Feb 2004, Armand Turpel wrote: > Hi, > > flock($_fp, LOCK_EX ); > > return always false. I'm relativily shure that the file to flock is not flocked > elsewhere. php 4.3.3 is running as cgi on linux. > Wha

[PHP] flock problem

2004-02-28 Thread Armand Turpel
Hi, flock($_fp, LOCK_EX ); return always false. I'm relativily shure that the file to flock is not flocked elsewhere. php 4.3.3 is running as cgi on linux. What is going wrong? thanks for an answer.

[PHP] flock and unix/apache

2002-04-09 Thread Matthew Luchak
PHP 4.1.2 SunOS web-unix1 5.7 apache_1.3.22     I'm porting from WIN2000 to Apache/Unix and having problems with the flock() function.  The following :   $fd = fopen ($file, "r");if (flock($fd, 2)) {   ...}     "if" statement never returns true...  any ideas? ___

[PHP] - Flock manual clarification please ;-)

2002-04-06 Thread Matt Friedman
>From the manual: Note: Because flock() requires a file pointer, you may have to use a special lock file to protect access to a file that you intend to truncate by opening it in write mode (with a "w" or "w+" argument to fopen()). The manual indicates that you "may" need to use "a special lock

[PHP] flock

2002-01-06 Thread David Robinson
I'm using flock to manage the access of a file. I've noticed that php seems to wait for the file to be freed up. Is there a ordered que that each request goes into? And a timeout period, or does it just wait? David -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMA