Yes, it's a permissions problem. If you can't arrange
a better solution, you can at least create a subdirectory
with 666 permission where you can store the file.
That's probably better than giving broader rights
to your DOCUMENT_ROOT (provided you don't store
anything more important than your counter files in
the new directory.)
By the way, you don't want "w+" access on your
file; this overwrites the existing file exactly as "w"
would. The access you want is "r+", which gives
read+write access but preserves the existing
contents. Yes, it means creating the file the
first time will be a special case.