Re: [PHP] File locking with PHP functions

2011-04-04 Thread Louis Huppenbauer
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

Re: [PHP] File locking with PHP functions

2011-04-04 Thread Stuart Dallas
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

[PHP] File locking with PHP functions

2011-04-04 Thread 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($filename, 'w'); Does this function lock the file from writes until fclose()? Does it lock from reads as well? fopen($filename, 'r+'); Does this function l

Re: [PHP] file locking...

2009-03-01 Thread Stuart
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

RE: [PHP] file locking...

2009-03-01 Thread 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 much quicker... > > this is going to han

RE: [PHP] file locking...

2009-03-01 Thread bruce
@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

RE: [PHP] file locking...

2009-03-01 Thread Robert Cummings
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

RE: [PHP] file locking...

2009-03-01 Thread bruce
et Subject: Re: [PHP] file locking... 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 proce

Re: [PHP] file locking...

2009-03-01 Thread Robert Cummings
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

Re: [PHP] file locking...

2009-03-01 Thread Ashley Sheridan
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

[PHP] file locking...

2009-02-28 Thread bruce
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 in a dir. Each process accesses a unique group of files, and th

RE: [PHP] File Locking during *other* file operations

2004-12-23 Thread Robinson, Matthew
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:

RE: [PHP] File Locking during *other* file operations

2004-12-20 Thread Richard Lynch
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

RE: [PHP] File Locking during *other* file operations

2004-12-20 Thread Robinson, Matthew
-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

Re: [PHP] File Locking during *other* file operations

2004-12-17 Thread Gerard Samuel
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

RE: [PHP] File Locking during *other* file operations

2004-12-17 Thread Michael Sims
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 (

[PHP] File Locking during *other* file operations

2004-12-16 Thread Gerard Samuel
Im talking about file locking during deleting, and moving files. Is it possible to perform file locking for these file operations? If so, can you provide psuedo code. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] File locking & file_[get|put]_contents

2004-12-14 Thread Gerard Samuel
I was wondering. Does file_get_contents() or file_put_contents() utilise any kind of file locking? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] File locking in PHP???

2004-07-15 Thread Curt Zirzow
* 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

Re: [PHP] File locking in PHP???

2004-07-15 Thread 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... FletchSOD "Matt M." <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > Hi! I saw the php function flock(), since I never used

Re: [PHP] File locking in PHP???

2004-07-15 Thread Scott Fletcher
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

Re: [PHP] File locking in PHP???

2004-07-15 Thread Matt M.
> 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

[PHP] File locking in PHP???

2004-07-15 Thread Scott Fletcher
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. 1) Is this function good or is there a better function somewhere that I'm not aware of? 2) If the flock() activated the file lock then is it possible that I manually unlock

Re: [PHP] file locking over NFS?

2004-07-06 Thread Manuel Lemos
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

Re: [PHP] file locking over NFS?

2004-07-06 Thread kyle
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

Re: [PHP] file locking over NFS?

2004-07-06 Thread Manuel Lemos
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

Re: [PHP] file locking over NFS?

2004-07-06 Thread kyle
e interested in, look at the flock() > function. > > Kind Regards > Brent Clark > > -Original Message- > From: kyle [mailto:[EMAIL PROTECTED] > Sent: Monday, July 05, 2004 6:54 PM > To: [EMAIL PROTECTED] > Subject: [PHP] file locking over NFS? > > > Hi all, >

Re: [PHP] file locking over NFS?

2004-07-06 Thread kyle
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

RE: [PHP] file locking over NFS?

2004-07-05 Thread Brent Clark
-Original Message- From: kyle [mailto:[EMAIL PROTECTED] Sent: Monday, July 05, 2004 6:54 PM To: [EMAIL PROTECTED] Subject: [PHP] file locking over NFS? Hi all, Is there any simple, safe, and efficiency way to do file locking over NFS? Thanks. -- PHP General Mailing List (http://www.php.net/) To

Re: [PHP] file locking over NFS?

2004-07-05 Thread Marek Kilimajer
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

[PHP] file locking over NFS?

2004-07-05 Thread kyle
Hi all, Is there any simple, safe, and efficiency way to do file locking over NFS? Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] file locking question

2004-06-21 Thread Michal Migurski
> 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

Re: [PHP] file locking question

2004-06-21 Thread Daniel Clark
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

Re: [PHP] file locking question

2004-06-21 Thread Marek Kilimajer
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

[PHP] file locking question

2004-06-21 Thread Brent Clark
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 MSN: [EMAIL PROTECTED] eMail: [EMAIL PROTECTED] Cell: +27 82 701 78

Re: [PHP] File locking problem

2002-11-08 Thread Charles Wiltgen
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

Re: [PHP] File locking problem

2002-11-08 Thread Ernest E Vogelsinger
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

Re: [PHP] File locking problem

2002-11-08 Thread Charles Wiltgen
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

Re: [PHP] File locking problem

2002-11-08 Thread Krzysztof Dziekiewicz
> 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

Re: [PHP] File locking problem

2002-11-07 Thread Charles Wiltgen
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

Re: [PHP] File locking problem

2002-11-07 Thread Marco Tabini
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

Re: [PHP] File locking problem

2002-11-07 Thread Charles Wiltgen
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

Re: [PHP] File locking problem

2002-11-07 Thread Marco Tabini
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 :-)

Re: [PHP] File locking problem

2002-11-07 Thread Charles Wiltgen
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

Re: [PHP] File locking problem

2002-11-06 Thread Charles Wiltgen
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

Re: [PHP] File locking problem

2002-11-06 Thread Marco Tabini
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

[PHP] File locking problem

2002-11-06 Thread Charles Wiltgen
Hello, 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 flushed a

Re: [PHP] File Locking in PHP.

2001-02-19 Thread David Robley
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

[PHP] File Locking in PHP.

2001-02-19 Thread Matthew Toledo
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 instance, in PERL, you use the flock command to set up an advi