Reply to Re: [PHP] Re: fopen

Your name:

Reply:


Posted by Richard Lynch on 10/20/22 11:11

On Mon, March 21, 2005 9:29 pm, John Taylor-Johnston said:
>> > flock($results, 2); #lock file for writing
>> > fwrite($results, $filestr); #write $filestr to $results
>> > flock($results, 3); #unlock file
>> > fclose($results); #close file
>> This is an incorrect way to try to flock a file for writing.
>>
>> You should:
>> 1) Open the file for READING.
>> 2) flock that file handle, so only YOU have access to that file.
>> 3) Re-open the file for WRITING, now that you have control.
>> 4) Write your data
>> 5) Release the lock.
>
> Could you show me a correct method, or example please? I admit I'm a
> little too newbie with flock. I have not used it since my Perl days, and
> even then ...

http://php.net/flock

has several correct examples, along with reasons when to not use flock in
the first place, as well as alternative solutions.

--
Like Music?
http://l-i-e.com/artists.htm

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация