PHP Warning: Cannot modify header information – headers already sent by
Solution : PHP Warning: Cannot modify header information – headers already sent by
Why these problem generally occurs when a php developer try to code. Let us moving to to details we are going to discuss why these issue occurs.
Blank lines between
?> and <?php
tags are being sent to the client.
When the first one of those is sent, it causes your headers to be sent first to client.
Once that happens, you can’t modify the headers any more.
Remove those unnecessary tags, try to have it all in one big
<?php block
.
Reasons:
There is likely whitespace outside of your php tags.
Empty lines, chars or spaces after ?> when using an php include file
…
…
Solution:
Remove everything after
?>
tag in the php include file.
These space of line after ?> tends to display warning for header already sent.