Solution for Headers Already Sent problem in php scripts and frameworks

| No Comments »

Headers already sent issue?

Here’s how to fix one of the most common problems in frameworks and websites:

Problem: Help! i’m getting the errors and/or warnings – “Headers already sent!

Answer #1: Check the php files which are usually found in your headers(the ones which are loaded first, typically config.php) and look for extra spaces before your <?php start tag and spaces after ?> end tag. Delete them and voila! Problem Solved!

Answer #2: Check your header scripts(The first few lines of code) and make sure you’re not outputting anything(e.g: an echo, sprintf or a warning message) before using header.



Leave a Reply