How to fix “Headers already sent” error in PHP

When running my script, I am getting several errors like this:

Warning: Cannot modify header information - headers already sent by (output started at /home/dealsm5/public_html/wp-includes/functions.php:3792) in /home/dealsm5/public_html/wp-includes/pluggable.php on line 1228

What could be the reason for this? And how to fix it?