Start Simple
<?php
  $cnt_file 
'/tmp/'.basename(__FILE__).'.cnt';;
  
$num = (int)@file_get_contents($cnt_file);
  
$num++;
  
file_put_contents($cnt_file$num); 
  echo 
"File has been accessed $num times";
?>
Output
File has been accessed 34 times