This does not actually gives you the error rather it shows you a warning. There are some functions in PHP which are work properly only if you use them before sending any output to the browser. So like header(), setcookie(), session_start(), etc. functions have to be used before sending any output. Be careful even a single space before the opening first php tag will cause the warning. See the function in manual for more details.