Quantcast
Channel: How can I prevent a race condition when using a file based counter in php? - Stack Overflow
Browsing latest articles
Browse All 2 View Live

Answer by Sean-McCreary for How can I prevent a race condition when using a...

Just in case anyone finds themselves with the same issue, I was able to fix the problem by adding inflock($fp, LOCK_EX | LOCK_NB) before writing into the file as per the documentation for php's flock...

View Article



How can I prevent a race condition when using a file based counter in php?

I have a small web-page that delivers different content to a user based on a %3 (modulo 3) of a counter. The counter is read in from a file with php, at which point the counter is incremented and...

View Article
Browsing latest articles
Browse All 2 View Live




Latest Images