I am making a simple page load counter by storing the current count in a file. This is how I want to do this:
I believe you can achieve this using flock. Open a pointer to your file, flock it, read the data, write the data, then close (close automatically unlocks).
flock
http://php.net/flock