Re: File locking problem
| From: | Charles Wiltgen | Date: | Fri, 08 Nov 2002 15:50:53 +0000 |
| Subject: | Re: File locking problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-123396@lists.php.net to get a copy of this message | ||
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 it even exists).
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.
For a workaround, after I fflush() and fclose() I while() until the file
exists, and then while() until it's larger than 10 bytes. I should while()
until it's the size of the data I've written, but this method has been
reliable so far.
--
Charles Wiltgen
"Well, once again my friend, we find that science is a two-headed beast.
One head is nice, it gives us aspirin and other modern conveniences...
but the other head of science is bad! Oh beware the other head of
science...it bites!" -- The Tick