I have a strange problem that has now occurred in 2 separate cases.
I have php programs that usually perform some database update. At the end, I normally use the php header function, one example is in the attached header.php.
Note the commented out echo statement just before the headers.
I made some changes to the "real" program, ran it through a php syntax checker to insure no syntax errors, then ran it as a test. The headers are NOT executed, it stays on the page, which is blank so that it purposely produces nothing in the browser. Recognizing I must have some error, I insert some echos into the program to determine where the issue occurs, including the commented out one at the end, just before the headers.
I carefully comment out the headers themselves since I know the echos will negate the headers.
I run it with the echos, it shows them all, including the very last one.
When I do this, it works perfectly.
I have now had to do this in two different programs in a specific project.
Is there a situation where header does not work based on other conditions?
Again, I am aware it will NOT work if any content is sent to the browser before the headers.