I started to put together a few classes that reads/writes files,
using the fopen() function, injunction with flock() to
lock files while reading/writing.
And I also was wrapping fopen()/flock() around copy()/unlink()/rename()
with the thinking that they needed file locking *features* while
modifying the filesystem.
I initially chose to use flock() to cut down possibilities of *race
conditions*.
Now Im beginning to question even using the fopen()/flock() way of
reading/writing
files, and instead go to file_[get|put]_contents().
As I understand it, race conditions *can* occur during the php steps
of reading/writing files using the fopen() method ->
fopen(...);
// read or write to file with fread()/fwrite()
fclose(...);

Now my thinking is that if I were to start using file_[get|put]_contents(),
and do away with fopen()/flock(), there would be no need for file locking,
since file_[get|put]_contents() is just one php operation.
I may be wrong with this assumption.

Im looking to see what others may think about file locking using php
functions,
file_[get|put]_contents()/copy()/unlink()/rename() to read/write/modify
the filesystem.
Is it even neccessary in php5?

Thanks for any insight that you can provide...

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



Reply via email to