Posted by Gordon Burditt on 03/03/07 18:12
>I created a very simple application that reads and writes to a file, I
>was wondering if fopen when opening a file for write access blocks
>this file, i.e. when another user runs this script the script will
>halt until the first user closes its file handle.
You can pretty much count on PHP *not* automatically doing this for
you. For one thing, there are safe ways of two processes both
having the same file open for write and *not* clobbering each other
(e.g. each writes only to its own pre-existing record) that PHP
shouldn't prohibit it.
>If not how can I change php behavior to block such access?
All users of the file can use flock().
Navigation:
[Reply to this message]
|