What are common pitfalls when integrating a counter into a PHP guestbook without using MySQL?

Common pitfalls when integrating a counter into a PHP guestbook without using MySQL include not properly incrementing the counter variable, not saving the counter value to a file or session, and not displaying the counter on the guestbook page.

// Initialize counter variable
$counter = 0;

// Check if counter file exists and load counter value
if (file_exists('counter.txt')) {
    $counter = file_get_contents('counter.txt');
}

// Increment counter
$counter++;

// Save counter value to file
file_put_contents('counter.txt', $counter);

// Display counter on the guestbook page
echo 'Total visitors: ' . $counter;