In your test script, make sure there is nothing before the opening <?php
Not a blank line. Not a space. Not a BOM (byte order mark, an unprintable character that some text editors add to the beginning of text documents).
If there is anything, then it gets sent to output. Which automatically...