Home > Software design >  Does the PHP fopen() "a" mode need file locking?
Does the PHP fopen() "a" mode need file locking?

Time:10-07

I vaguely remember years ago someone saying that the a mode in the PHP fopen() call doesn't file locking - is this true?

CodePudding user response:

The documentation does not mention anything about locking.

However, there are some references about the flock function. This function is to be called after fopen as it takes a stream handle as parameter.

It allows to acquire an exclusive lock, or a shared lock. It can also be released manually or automatically when calling fclose on locked resource, or when the said resource is garbage collected.

  • Related