What is the common error message "Cannot modify header information - headers already sent by" in PHP and what does it indicate?

The common error message "Cannot modify header information - headers already sent by" in PHP indicates that there was some output (such as whitespace or HTML) sent before PHP tried to modify headers using functions like header() or setcookie(). To fix this issue, make sure that there is no output sent before modifying headers, and ensure that all header-modifying functions are called before any output is sent to the browser.

<?php
ob_start(); // Start output buffering

// Your PHP code here

ob_end_flush(); // Flush the output buffer