How to remove “headers already sent” error in PHP


This error occurs mainly when you are working PHP in Linux Servers.

Method 1

The "headers already sent" error is usually caused by having white space before or after the opening and closing PHP tags (<?php . . . ?>).

Method 2

In top of page put


In bottom of page put


Method 3

Please don’t put any HTML Content or <?php echo “ ”; ?> tags before header () function. It’s simply means that before executing header () function nothing will displayed as HTML.

You can leave a response, or trackback from your own site.

Leave a Reply