Australian Made and Owned

Check if Headers Have Already Been Sent in PHP

Posted July 22, 2009

Most PHP programmers would have come across this old chestnut before:
Cannot modify header information – headers already sent by page.php line 42

This can happen when you try doing a HTTP redirect or send HTTP 404, as it can happen whenever you try to send headers once they’ve already been sent. When a user sees this, they are basically left high and dry, often on a blank page. The solution is simple:
(more…)

Filed under: PHP, Troubleshooting — Tags: , , , , , — Tim @ 3:39 pm