It’s not the echo
statements that are the problem. It looks like you have a header
call somewhere later in the file, but you can’t send headers once you output any text at all. You could either move the headers to the beginning of the script or alternatively use output buffering.