file locking in php -
I had a newcomer (next door teenager) Write some php code to track some usage on my web site I'm not familiar with php, so I'm asking about concurrent file access.
My original app (on Windows), sometimes kills the URL and puts some data in which my PHP script. The original application does not check returned data.
$ fh = fopen ($ updateFile, 'a') or die ("can not open file"); FILIT ($ FH, $ IP); FILIT ($ FH, ','); FILIT ($ FH, $ date); FILIT ($ FH, ','); FILIT ($ FAH, FETलोड (',', $ _GET)); FILIT ($ FH, "\ r \ n"); Fclose ($ fh); This is a low traffic site, and data is not important. But what if two users try to bump and try to add a line in two example script files? Is there any hidden file locking in PHP?
Is at least safe with code locking and never returning control to my user? Can the file be corrupted? If I have a file script above, then delete the file every month, what happens if another example of the script is between writing the file?
You should lock on file:
Comments
Post a Comment