RE: How to make sure that the target file to read is not under writing by others?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----Original Message-----
From: Tom Worster [mailto:fsb@xxxxxxxxxx] 
Sent: 20 August 2009 01:28 PM
To: Clancy; php-general@xxxxxxxxxxxxx
Subject: Re:  How to make sure that the target file to read is not
under writing by others?

On 8/19/09 9:56 PM, "Clancy" <clancy_1@xxxxxxxxxxxx> wrote:

> I gather from this discussion that PHP allows two users to open a file 
> for R/W? I had assumed it wouldn't.

i think php does allow this. but i'm not sure all file systems do.

--

PHP does allow more than one process to open a file for read-write, as does
every other filesystem I know of (PHP doesn't have a filesystem, it
implements a subset of file commands common to all OS's [some differences
between *nix and Windows] that it uses to communicate with the underlying OS
filesystem). If there's a need to ensure that multiple processes don't step
on each others toes the file can be locked. The two most common file
accesses are read and append, where a lock is mostly not required. It's only
in special cases where you want to write or update something and want to be
sure that another process isn't trying to update the same data or trying to
read data that may no longer be consistent (until you finish your update)
that you'd want to lock it.

Cheers
Arno


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux