It may not be a direct answer to your question, but...
You could just use flock() to lock the file while accessing it.
louis
2011/4/4 Paul M Foster :
> I'd like to know (from someone who knows the internals more than I do)
> whether the following functions lock files and to what extent:
>
> fopen
On Monday, 4 April 2011 at 15:28, Paul M Foster wrote:
I'd like to know (from someone who knows the internals more than I do)
> whether the following functions lock files and to what extent:
>
> fopen($filename, 'w');
>
> Does this function lock the file from writes until fclose()?
> Does it lock
2009/3/1 Robert Cummings
> On Sun, 2009-03-01 at 10:05 -0800, bruce wrote:
> > hi rob...
> >
> > what you have written is similar to my initial approach... my question,
> and
> > the reason for posting this to a few different groups.. is to see if
> someone
> > has pointers/thoughts for something
On Sun, 2009-03-01 at 10:05 -0800, bruce wrote:
> hi rob...
>
> what you have written is similar to my initial approach... my question, and
> the reason for posting this to a few different groups.. is to see if someone
> has pointers/thoughts for something much quicker...
>
> this is going to han
@lists.php.net
Subject: RE: [PHP] file locking...
On Sun, 2009-03-01 at 09:09 -0800, bruce wrote:
> hi rob...
>
> here's the issue in more detail..
>
> i have multiple processes that are generated/created and run in a
> simultaneous manner. each process wants to get XX number of files f
On Sun, 2009-03-01 at 09:09 -0800, bruce wrote:
> hi rob...
>
> here's the issue in more detail..
>
> i have multiple processes that are generated/created and run in a
> simultaneous manner. each process wants to get XX number of files from the
> same batch of files... assume i have a batch of 50
ere i get rid of the files.. and i use some sort
of database as the informational storage.
hopefully this provides a little more clarity.
thanks
-Original Message-
From: Robert Cummings [mailto:rob...@interjinn.com]
Sent: Sunday, March 01, 2009 2:50 AM
To: bruce
Cc: php-general@lists.php.n
On Sat, 2009-02-28 at 21:46 -0800, bruce wrote:
> Hi.
>
> Got a bit of a question/issue that I'm trying to resolve. I'm asking this of
> a few groups so bear with me.
>
> I'm considering a situation where I have multiple processes running, and
> each process is going to access a number of files i
On Sat, 2009-02-28 at 21:46 -0800, bruce wrote:
> Hi.
>
> Got a bit of a question/issue that I'm trying to resolve. I'm asking this of
> a few groups so bear with me.
>
> I'm considering a situation where I have multiple processes running, and
> each process is going to access a number of files i
lock fails. I think
that locks fail for a reason and you should find that reason before you
unlock and potentially break something.
M
-Original Message-
From: Richard Lynch [mailto:[EMAIL PROTECTED]
Sent: 20 December 2004 18:26
To: Robinson, Matthew
Cc: Michael Sims; php-general
Subject:
Robinson, Matthew wrote:
> I use this code, Not all my own, some from the php manual (probably
> most of it in fact) I lock the file as filename.lock so that I can muck
> about with it completely and then unlock the .lock and remove it.
>
> M
>
> function LockFile($file)
> {
>
> $LockFile
-Original Message-
From: Michael Sims [mailto:[EMAIL PROTECTED]
Sent: 17 December 2004 15:28
To: php-general
Subject: RE: [PHP] File Locking during *other* file operations
Gerard Samuel wrote:
> Im talking about file locking during deleting, and moving files.
> Is it possible to perfo
Michael Sims wrote:
Yes, have your scripts attempt to lock a separate lock file before performing
deleting or moving operations.
Jason Barnett wrote:
Sure... just acquire the exclusive lock like you would for writing to
a file, but do the delete / move instead. Your apps must actually try
to
Gerard Samuel wrote:
> Im talking about file locking during deleting, and moving
> files.
> Is it possible to perform file locking for these file operations?
Yes, have your scripts attempt to lock a separate lock file before performing
deleting or moving operations.
--
PHP General Mailing List (
* Thus wrote Scott Fletcher:
> Nah! I'll settle for a simplier one... file_exists() by checking to see
> if the file exist then spit out the error message. Meaning the file is in
> use...
Don't use file_exists() for that, it will fail miserable with
racing conditions. a better more portable wa
Nah! I'll settle for a simplier one... file_exists() by checking to see
if the file exist then spit out the error message. Meaning the file is in
use...
FletchSOD
"Matt M." <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> > Hi! I saw the php function flock(), since I never used
Yea, read that, very good info there. Alright, I'll make one from scratch
and do some testing to find what need to be add/change/remove to make it
more a rock solid script. Boy, it remind me of Perl.
Thanks,
FletchSOD
"Matt M." <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> > Hi
> Hi! I saw the php function flock(), since I never used it before so I
> thought I would ask you folks a couple of questions.
did you read all of the user comments on http://us2.php.net/flock
There is a bunch of good info in there
--
PHP General Mailing List (http://www.php.net/)
To unsubscri
Hello,
On 07/06/2004 12:56 PM, Kyle wrote:
Hi Manuel,
Do you mean I can just use flock over NFS ?
It depends. You need to check whether the NFS server that you use
supports it.
--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Re
Hi Manuel,
Do you mean I can just use flock over NFS ?
"Manuel Lemos" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hello,
>
> On 07/06/2004 05:25 AM, Kyle wrote:
> > I found this from php function list manual:
> > "flock() will not work on NFS and many other networked file system
Hello,
On 07/06/2004 05:25 AM, Kyle wrote:
I found this from php function list manual:
"flock() will not work on NFS and many other networked file systems. Check
your operating system documentation for more details."
I wish flock can do NFS file locking, but offical manual says no to
This is not ac
I found this from php function list manual:
"flock() will not work on NFS and many other networked file systems. Check
your operating system documentation for more details."
I wish flock can do NFS file locking, but offical manual says no to
"Brent Clark" <[EMAIL PROTECTED]> wrote in message
news
Thanks a lot , your information is really useful for me.
"Marek Kilimajer" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> kyle wrote:
> > Hi all,
> >
> > Is there any simple, safe, and efficiency way to do file locking over
NFS?
> >
> > Thanks.
> >
>
> You can mysql locks (maybe it
Hi there
If i am not mistaken, that is a standard part of the nfs suite.
All you need to make sure is that your export is correct, and the you are
not using the
-nolock option.
Other than that if its PHP you more interested in, look at the flock()
function.
Kind Regards
Brent Clark
-Original
kyle wrote:
Hi all,
Is there any simple, safe, and efficiency way to do file locking over NFS?
Thanks.
You can mysql locks (maybe it works in other databases too):
GET_LOCK(str,timeout);
RELEASE_LOCK(str);
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/u
> I have this script whereby I use the php function file().
> Just a quick question, do I need to implement file locking.
If you want to ensure that the file is not changed by other scripts while
you're reading from it, yes. Note that this is advisory only - writer
scripts will only respect the lo
If you're just going to read only, no.
>>Hi all
>>
>>I have this script whereby I use the php function file().
>>Just a quick question, do I need to implement file locking.
>>
>>if so, can I just use something like
>> flock( file("/path/file.ext") );
>>
>>Kind Regards
>>Brent Clark
--
PHP G
Brent Clark wrote --- napĂsal::
Hi all
I have this script whereby I use the php function file().
Just a quick question, do I need to implement file locking.
if so, can I just use something like
flock( file("/path/file.ext") );
No, you need file locking only for writing.
--
PHP General Maili
Ernest E Vogelsinger wrote...
>> This has to be a PHP bug, which I'd be happy to file if someone more
>> experienced could confirm that it isn't stupid user error.
>
> I don't believe it has something to do with PHP, much more with the FTP server
> you're accessing... This might delay the actual
At 16:50 08.11.2002, Charles Wiltgen spoke out and said:
[snip]
>I tried require() too, but it made no difference. I later learned that if
>you fopen(), write some stuff, fflush() and ffclose(), that doesn't mean the
>file is complete (or that it even exists
Krzysztof Dziekiewicz wrote...
> Do you use "include" or "require". In such situation you should not use
> "include".
I tried require() too, but it made no difference. I later learned that if
you fopen(), write some stuff, fflush() and ffclose(), that doesn't mean the
file is complete (or that i
> I'm having file locking problems.
> I'm using fopen() to write a file via FTP. At the end, I'm doing...
> fflush($fp);
> fclose($fp);
> ...and then I include it immediately after. But many times I only get part
> of what I wrote to the file, which suggests that it wasn't really flush
Marco Tabini wrote...
> Ok, here's another possibly stupid solution.
Not at all. My solution was not far from that -- I have to wait for the
file to exist, and then to have something in it, and then include it. (See
my "PHP fopen() bug + solution" post.)
Thank you,
-- Charles Wiltgen
--
PH
Ok, here's another possibly stupid solution. Have you tried (a) setting
a pause (like 2 secs) between when you end writing and include the file
or (b) writing the file, then refreshing the page with a parameter and
including it only then? In the latter case, terminating the script and
refreshing it
Marco Tabini wrote...
> 1) What OS are you using?
Linux.
> 2) Does the file include PHP code?
Yes.
> If it contains PHP code, are you sure that there aren't any errors in the PHP
> code?
Yes. The resulting XHTML validates when the include works (more than half
the time). The rest of the tim
Charles,
2 questions--
1) What OS are you using?
2) Does the file include PHP code? Otherwise, can you keep its contents
in a string and simply output that string? If it contains PHP code, are
you sure that there aren't any errors in the PHP code?
Ok, so it was a bit more than 2 questions :-)
Charles Wiltgen wrote...
> I'm having file locking problems.
>
> I'm using fopen() to write a file via FTP. At the end, I'm doing...
>
> fflush($fp);
> fclose($fp);
>
> ...and then I include it immediately after. But many times I only get part
> of what I wrote to the file, which suggests
Marco Tabini wrote...
> Just a (possibly stupid) suggestion--is it possible that the file is being
> overwritten by another instance of your script that's run in the meantime?
This may also be a problem at some point, but currently I'm just trying to
get it working in an test environment where on
Just a (possibly stupid) suggestion--is it possible that the file is
being overwritten by another instance of your script that's run in the
meantime?
-
php|architect -- The Magazine for PHP Professionals
Check us out on the web at http://www.phparch.com
On Wed, 2002-11-06 at 23:06, Ch
On Tue, 20 Feb 2001 08:50, Matthew Toledo wrote:
> Hello, I am just starting to use PHP. I have been using PERL for quite
> some time. I was wondering if there is any specific FILE LOCKING I
> need to implement to keep more than one person from altering a text
> file at the same time.
>
> For in
40 matches
Mail list logo