I have a PHP file that counts a value that increases very often:
<?$totI=515905;?>
Sometimes another file resets the $totI variable (maybe because it loads and writes it two times together).
How can I fix this?
I have a PHP file that counts a value that increases very often:
<?$totI=515905;?>
Sometimes another file resets the $totI variable (maybe because it loads and writes it two times together).
How can I fix this?
I fixed it by using fopen($file,"a")
instead of fopen($file,"w")
and by adding ftruncate
after the flock
function