What is the common error message encountered when trying to set a cookie in PHP?

When trying to set a cookie in PHP, a common error message encountered is "Cannot modify header information - headers already sent". This error occurs when there is any output sent to the browser before setting the cookie, as cookies must be set before any output is sent. To solve this issue, make sure to set cookies before any HTML content or any other output.

<?php
// Set cookie before any output
setcookie("user", "John Doe", time() + 3600, "/");
?>